Pure C++20 plotting API with pluggable backends for publication-ready IEEE/AIAA figures.
cmake --preset dev-debug
cmake --build --preset build-debug
ctest --preset test-debugflowchart LR
A[FigureSpec/AxesSpec/SeriesSpec] --> B[Figure/Axes Containers]
B --> C[IPlotBackend]
C --> D[GnuplotBackend]
C --> E[SvgBackend]
C --> J[PngBackend]
D --> F[tmp/*.dat]
D --> G[tmp/figure.gp]
D --> H[figure.pdf|svg|eps|png]
E --> I[figure.svg]
J --> K[figure.png]
sequenceDiagram
participant App as Example App (C++)
participant Fig as gnuplotpp::Figure
participant Be as Selected Backend
App->>Fig: configure spec/layout + add series
App->>Fig: save(out_dir)
Fig->>Be: render(fig, out_dir)
Be-->>Fig: RenderResult
Fig-->>App: output paths
dev-debugdev-releasedev-cpmbuild-debugbuild-releasebuild-cpmtest-debugtest-release
CPM is optional via GNUPLOTPP_ENABLE_CPM=ON.
When enabled, CMake downloads CPM.cmake and resolves C++ libraries (nlohmann_json, fmt, spdlog).
If network/package resolution fails, configuration now degrades with warnings and continues.
- CPM is best for CMake/C++ dependencies.
gnuplotis an external CLI renderer.- Recommended: install
gnuplotwith system package managers and keep CPM for C++ libs.
RenderResultincludesRenderStatus(Success,InvalidInput,IoError,ExternalToolMissing,ExternalToolFailure,UnsupportedFormat).- Backends emit detailed file/tool failure messages and return explicit statuses.
- If
fmtandspdlogare available (via CPM or system packages), the library uses them for structured formatting/logging. - If not available, behavior falls back to standard C++ streams with the same status semantics.
You run only the C++ executable.
- If
gnuplotexists, examples render publication outputs (pdf/svg/png) viaGnuplotBackend. - If
gnuplotis missing, examples automatically fall back to nativePngBackendand generatefigure.png. - If PNG fallback fails, examples try native
SvgBackendas a secondary fallback.
./build/dev-debug/two_window_example --out out/two_window
./build/dev-debug/layout_2x2_example --out out/layout_2x2Generated outputs include at least:
out/<name>/figures/figure.png