{"id":25854788,"url":"https://github.com/jchristopherson/fplot","last_synced_at":"2026-02-09T17:30:51.323Z","repository":{"id":31270396,"uuid":"110254484","full_name":"jchristopherson/fplot","owner":"jchristopherson","description":"A Fortran library providing a convenient interface for plotting with Gnuplot.","archived":false,"fork":false,"pushed_at":"2025-12-15T14:18:47.000Z","size":12879,"stargazers_count":39,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-18T17:53:35.115Z","etag":null,"topics":["fortran","fortran-package-manager","gnuplot","plot","plotting","scientific-visualization"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jchristopherson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-11-10T14:14:32.000Z","updated_at":"2025-12-15T14:17:41.000Z","dependencies_parsed_at":"2024-01-17T13:14:04.746Z","dependency_job_id":"0bc4f805-9029-4ccb-8bdc-99b330f02eba","html_url":"https://github.com/jchristopherson/fplot","commit_stats":{"total_commits":299,"total_committers":2,"mean_commits":149.5,"dds":"0.0033444816053511683","last_synced_commit":"a46a3b175b9b210613bb76c75f328cebe34b95ff"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/jchristopherson/fplot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffplot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffplot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffplot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffplot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchristopherson","download_url":"https://codeload.github.com/jchristopherson/fplot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchristopherson%2Ffplot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29273645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T17:15:22.002Z","status":"ssl_error","status_checked_at":"2026-02-09T17:14:42.395Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","fortran-package-manager","gnuplot","plot","plotting","scientific-visualization"],"created_at":"2025-03-01T16:18:11.344Z","updated_at":"2026-02-09T17:30:51.307Z","avatar_url":"https://github.com/jchristopherson.png","language":"Fortran","readme":"# fplot\nA Fortran library providing a convenient interface for plotting with Gnuplot.\n\n\n## Status\n![Build Status](https://github.com/jchristopherson/fplot/actions/workflows/cmake.yml/badge.svg)\n[![Actions Status](https://github.com/jchristopherson/fplot/workflows/fpm/badge.svg)](https://github.com/jchristopherson/fplot/actions)\n\n## GNUPLOT\nThis library is tailored to write script files for GNUPLOT.  As such, GNUPLOT is required to make use of the output of this library.  GNUPLOT can be found [here](http://www.gnuplot.info/).\n\n## Documentation\nDocumentation can be found [here](https://jchristopherson.github.io/fplot/)\n\n## Building FPLOT\n[CMake](https://cmake.org/)This library can be built using CMake.  For instructions see [Running CMake](https://cmake.org/runningcmake/).\n\n[FPM](https://github.com/fortran-lang/fpm) can also be used to build this library using the provided fpm.toml.\n```txt\nfpm build\n```\nThe FPLOT library can be used within your FPM project by adding the following to your fpm.toml file.\n```toml\n[dependencies]\nfplot = { git = \"https://github.com/jchristopherson/fplot\" }\n```\n\n## External Libraries\nThe FPLOT library depends upon the following libraries.\n- [FERROR](https://github.com/jchristopherson/ferror)\n- [COLLECTIONS](https://github.com/jchristopherson/collections)\n- [FSTRING](https://github.com/jchristopherson/fstring)\n- [GEOMPACK](https://github.com/jchristopherson/geompack)\n- [FORCOLORMAP](https://github.com/vmagnin/forcolormap)\n\n## Example 1\nThis example illustrates how to plot two-dimensional data.\n```fortran\nprogram example\n    use, intrinsic :: iso_fortran_env\n    use fplot_core\n    implicit none\n\n    ! Parameters\n    integer(int32), parameter :: n = 1000\n\n    ! Local Variables\n    real(real64), dimension(n) :: x, y1, y2\n    type(plot_2d) :: plt\n    type(plot_data_2d) :: d1, d2\n    class(plot_axis), pointer :: xAxis, yAxis\n    type(legend), pointer :: leg\n    \n    ! Initialize the plot object\n    call plt%initialize()\n\n    ! Define titles\n    call plt%set_title(\"Example Plot\")\n    call plt%set_font_size(14)\n\n    xAxis =\u003e plt%get_x_axis()\n    call xAxis%set_title(\"X Axis\")\n\n    yAxis =\u003e plt%get_y_axis()\n    call yAxis%set_title(\"Y Axis\")\n\n    ! Establish legend properties\n    leg =\u003e plt%get_legend()\n    call leg%set_is_visible(.true.)\n    call leg%set_draw_inside_axes(.false.)\n    call leg%set_horizontal_position(LEGEND_CENTER)\n    call leg%set_vertical_position(LEGEND_BOTTOM)\n    call leg%set_draw_border(.false.)\n\n    ! Define the data, and then add it to the plot\n    x = linspace(0.0d0, 10.0d0, n)\n    y1 = sin(5.0d0 * x)\n    y2 = 2.0d0 * cos(2.0d0 * x)\n\n    call d1%define_data(x, y1)\n    call d2%define_data(x, y2)\n\n    ! Define properties for each data set\n    call d1%set_name(\"Data Set 1\")\n    call d1%set_draw_markers(.true.)\n    call d1%set_marker_frequency(10)\n    call d1%set_marker_style(MARKER_EMPTY_CIRCLE)\n    call d1%set_marker_scaling(2.0)\n\n    call d2%set_name(\"Data Set 2\")\n    call d2%set_line_style(LINE_DASHED)\n    call d2%set_line_width(2.0)\n\n    ! Add the data sets to the plot\n    call plt%push(d1)\n    call plt%push(d2)\n\n    ! Let GNUPLOT draw the plot\n    call plt%draw()\nend program\n```\nThis is the plot resulting from the above program.\n![](images/example_2d_plot_1.png?raw=true)\n\n## Example 2\nAnother example of a similar two-dimensional plot to the plot in example 1 is given below.  This plot shifts the x-axis to the zero point along the y-axis.\n```fortran\n! fplot_2d_2.f90\n\nprogram example\n    use, intrinsic :: iso_fortran_env\n    use fplot_core\n    implicit none\n\n    ! Parameters\n    integer(int32), parameter :: n = 1000\n\n    ! Local Variables\n    real(real64), dimension(n) :: x, y1, y2\n    type(plot_2d) :: plt\n    type(plot_data_2d) :: d1, d2\n    class(plot_axis), pointer :: xAxis, yAxis\n    type(legend), pointer :: lgnd\n    \n    ! Initialize the plot object\n    call plt%initialize()\n    \n    ! Set plot properties\n    call plt%set_draw_border(.false.)\n    call plt%set_show_gridlines(.false.)\n\n    ! Define the legend location\n    lgnd =\u003e plt%get_legend()\n    call lgnd%set_is_visible(.true.)\n    call lgnd%set_draw_inside_axes(.false.)\n\n    ! Define titles\n    call plt%set_title(\"2D Example Plot 2\")\n\n    xAxis =\u003e plt%get_x_axis()\n    call xAxis%set_title(\"X Axis\")\n    call xAxis%set_zero_axis(.true.)\n    call xAxis%set_zero_axis_line_width(1.0)\n\n    yAxis =\u003e plt%get_y_axis()\n    call yAxis%set_title(\"Y Axis\")\n\n    ! Define the data, and then add it to the plot\n    x = linspace(0.0d0, 10.d0, n)\n    y1 = sin(5.0d0 * x)\n    y2 = 2.0d0 * cos(2.0d0 * x)\n\n    call d1%define_data(x, y1)\n    call d2%define_data(x, y2)\n\n    ! Define properties for each data set\n    call d1%set_name(\"Data Set 1\")\n    call d1%set_line_width(1.0)\n\n    call d2%set_name(\"Data Set 2\")\n    call d2%set_line_style(LINE_DASHED)\n    call d2%set_line_width(2.0)\n\n    ! Add the data sets to the plot\n    call plt%push(d1)\n    call plt%push(d2)\n\n    ! Let GNUPLOT draw the plot\n    call plt%draw()\nend program\n```\nThis is the plot resulting from the above program.\n![](images/example_2d_plot_2.png?raw=true)\n\n## Example 3\nThe following example illustrates how to create a three-dimensional surface plot.  The plot also leverages the [FORCOLORMAP](https://github.com/vmagnin/forcolormap) library to provide the colormap.\n```fortran\nprogram example\n    use fplot_core\n    use iso_fortran_env\n    use forcolormap, only : colormaps_list\n    implicit none\n\n    ! Parameters\n    integer(int32), parameter :: m = 50\n    integer(int32), parameter :: n = 50\n\n    ! Local Variables\n    real(real64), dimension(m, n, 2), target :: xy\n    real(real64), pointer, dimension(:,:) :: x, y\n    real(real64), dimension(m, n) :: z\n    type(surface_plot) :: plt\n    type(surface_plot_data) :: d1\n    class(plot_axis), pointer :: xAxis, yAxis, zAxis\n    type(custom_colormap) :: map\n    type(cmap) :: colors\n\n    ! Set up the colormap\n    call colors%set(\"glasgow\", -8.0d0, 8.0d0)\n    call map%set_colormap(colors)\n\n    ! Define the data\n    xy = meshgrid(linspace(-5.0d0, 5.0d0, n), linspace(-5.0d0, 5.0d0, m))\n    x =\u003e xy(:,:,1)\n    y =\u003e xy(:,:,2)\n\n    ! Initialize the plot\n    call plt%initialize()\n    call plt%set_colormap(map)\n\n    ! Establish lighting\n    call plt%set_use_lighting(.true.)\n\n    ! Set the orientation of the plot\n    call plt%set_elevation(20.0d0)\n    call plt%set_azimuth(30.0d0)\n    \n    ! Define titles\n    call plt%set_title(\"Example Plot\")\n    \n    xAxis =\u003e plt%get_x_axis()\n    call xAxis%set_title(\"X Axis\")\n\n    yAxis =\u003e plt%get_y_axis()\n    call yAxis%set_title(\"Y Axis\")\n\n    zAxis =\u003e plt%get_z_axis()\n    call zAxis%set_title(\"Z Axis\")\n\n    ! Define the function to plot\n    z = sqrt(x**2 + y**2) * sin(x**2 + y**2)\n    call d1%define_data(x, y, z)\n    call plt%push(d1)\n\n    ! Draw the plot\n    call plt%draw()\nend program\n```\nThis is the plot resulting from the above program.\n![](images/custom_colormap.png?raw=true)\n\n## Example 4\nThe following example illustrates how to create a vector-field plot.  This example illustrates using one of the built-in colormaps to to help illustrate vector magnitude.\n```fortran\nprogram example\n    use iso_fortran_env\n    use fplot_core\n    implicit none\n\n    ! Local Variables\n    type(plot_2d) :: plt\n    type(vector_field_plot_data) :: ds1\n    class(plot_axis), pointer :: xAxis, yAxis\n    type(rainbow_colormap) :: cmap\n    real(real64), allocatable, dimension(:,:,:) :: pts\n    real(real64), allocatable, dimension(:,:) :: dx, dy\n    real(real64) :: dxdt(2)\n    integer(int32) :: i, j\n\n    ! Create a grid of points defining the vector locations\n    pts = meshgrid( \u0026\n        linspace(-2.0d0, 2.0d0, 20), \u0026\n        linspace(-5.0d0, 5.0d0, 20))\n\n    ! Compute the values of each derivative\n    allocate(dx(size(pts, 1), size(pts, 2)))\n    allocate(dy(size(pts, 1), size(pts, 2)))\n    do j = 1, size(pts, 2)\n        do i = 1, size(pts, 1)\n            call eqn([pts(i,j,1), pts(i,j,2)], dxdt)\n            dx(i,j) = dxdt(1)\n            dy(i,j) = dxdt(2)\n        end do\n    end do\n\n    ! Define arrow properties\n    call ds1%set_arrow_size(0.1d0)  ! 1.0 by default\n    call ds1%set_fill_arrow(.true.) ! .false. by default\n\n    ! Create the plot\n    call plt%initialize()\n    call plt%set_font_size(14)\n    xAxis =\u003e plt%get_x_axis()\n    yAxis =\u003e plt%get_y_axis()\n\n    ! Define axis labels\n    call xAxis%set_title(\"x(t)\")\n    call yAxis%set_title(\"dx/dt\")\n\n    ! Set plot style information\n    call xAxis%set_zero_axis(.true.)\n    call yAxis%set_zero_axis(.true.)\n    call plt%set_draw_border(.false.)\n    call plt%set_show_gridlines(.false.)\n\n    ! Define the colormap\n    call plt%set_colormap(cmap)\n\n    ! Add the data to the plot - color by the magnitude of gradient\n    call ds1%define_data(pts(:,:,1), pts(:,:,2), dx, dy, sqrt(dx**2 + dy**2))\n    call plt%push(ds1)\n\n    call plt%draw()\ncontains\n    ! Van der Pol Equation\n    ! x\" - mu * (1 - x^2) * x' + x = 0\n    subroutine eqn(x, dxdt)\n        real(real64), intent(in) :: x(2)\n        real(real64), intent(out) :: dxdt(2)\n\n        real(real64), parameter :: mu = 2.0d0\n\n        dxdt(1) = x(2)\n        dxdt(2) = mu * (1.0d0 - x(1)**2) * x(2) - x(1)\n    end subroutine\nend program\n```\nThis is the plot resulting from the above program.\n![](images/vector_plot_2.png?raw=true)\n\n## Example 5\nThe following example illustrates how to create a polar plot.\n```fortran\nprogram example\n    use iso_fortran_env\n    use fplot_core\n\n    ! Local Variables\n    integer(int32), parameter :: npts = 1000\n    real(real64), parameter :: pi = 2.0d0 * acos(0.0d0)\n    real(real64) :: t(npts), x(npts)\n    type(plot_polar) :: plt\n    type(plot_data_2d) :: pd\n\n    ! Create a function to plot\n    t = linspace(-2.0d0 * pi, 2.0d0 * pi, npts)\n    x = t * sin(t)\n\n    ! Plot the function\n    call plt%initialize()\n    call plt%set_font_size(14)\n    call plt%set_title(\"Polar Plot Example\")\n    call plt%set_autoscale(.false.)\n    call plt%set_radial_limits([0.0d0, 6.0d0])\n\n    call pd%define_data(t, x)\n    call pd%set_line_width(2.0)\n    call plt%push(pd)\n    call plt%draw()\nend program\n```\nThis is the plot resulting from the above program.\n![](images/polar_example_1.png?raw=true)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchristopherson%2Ffplot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchristopherson%2Ffplot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchristopherson%2Ffplot/lists"}