Native plotting in modern Fortran
HEALTH ? 96 / Healthy
Native plotting in modern Fortran
// readme
Fortran plotting with PNG, PDF, SVG and text output. The plotting core has no external graphics dependencies. Text output uses ASCII by default.
fpm:
[dependencies]
fortplot = { git = "https://github.com/lazy-fortran/fortplot" }
CMake: (full template)
include(FetchContent)
FetchContent_Declare(fortplot
GIT_REPOSITORY https://github.com/lazy-fortran/fortplot
GIT_TAG main)
FetchContent_MakeAvailable(fortplot)
target_link_libraries(your_target PRIVATE fortplot::fortplot)
The optional fortplot::fortarray target adapts labeled data_array_t values
without adding plotting methods or state to fortarray:
use fortarray, only: data_array_t, data_array
use fortplot, only: figure_t, wp
use fortplot_fortarray, only: plot
type(data_array_t) :: field
type(figure_t) :: fig
field = data_array([2.0_wp, 3.0_wp, 5.0_wp], ["radius"], name="samples")
call fig%initialize()
call plot(fig, field)
CMake users can omit that dependency with
-DFORTPLOT_BUILD_FORTARRAY_ADAPTER=OFF. fpmโฆ