Skip to content

vargalabs/plots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plot

Header-only C++ SVG charts — heatmap, line, scatter — GR-style API + Solarized themes.

CI MIT License Documentation

OS / Compiler GCC 13 GCC 14 Clang 18 Clang 20 Apple Clang MSVC
Ubuntu 22.04 gcc13 NA cl18 NA NA NA
Ubuntu 24.04 NA gcc14 NA cl20 NA NA
macOS 15 NA NA NA NA ac NA
Windows NA NA NA NA NA msvc

Badge and documentation URLs resolve only once GitHub Pages is enabled for this (private) repository — the CI badge job publishes to the gh-pages branch under badges/ (release) and badges-staging/ (staging).

Quick start

#include <plot/all>
#include <vector>

int main() {
  plot::theme(plot::solarized_dark);          // process default; per-call: plot::use{t}

  std::vector<double> x{1, 2, 3, 4, 5};
  plot::line("throughput.svg", x,
      { {"scalar", {820, 1500, 2600, 3400, 3900}},
        {"simd",   {1900, 4100, 7200, 9800, 11500}} },
      plot::title("throughput"), plot::xlabel{"n"}, plot::ylabel{"MB/s"});
}

Features

  • GR-style APIplot::line, plot::scatter, and plot::heatmap, each taking an output stream or filename plus order-independent named options (title, xlabel/ylabel, xlog/ylog, legend, width/height, margin).
  • Composable view + grid — the no-os form (plot::line(x, y, …)) returns a deferred, movable view rendered via plot::save("f.svg", view) / plot::render(os, view); plot::grid(file|os, plot::rows{r}, plot::cols{c}, view…) tiles several views into one figure (auto layout if rows/cols omitted).
  • Solarized themesplot::solarized_dark / plot::solarized_light; set the global default with plot::theme(t) or override per call with plot::use{t}.
  • Dependency-free C++23 — standard library only; no HDF5, zlib, boost, or third-party plotting/matrix/formatting libraries.
  • CMake-friendlyfind_package(plot) exposes the plot::plot target.

Themes

Set the process-global default with plot::theme(t), or override a single render with plot::use{t}:

plot::theme(plot::tokyo_night);                 // process-global
plot::line("bw.svg", x, y, plot::use{plot::dracula});   // per-call override

Presets shipping in theme.hpp (added in a parallel lane): solarized_dark, solarized_light, dark_plus, light_plus, monokai, dracula, nord, one_dark, gruvbox_dark, gruvbox_light, tomorrow_night, night_owl, material, tokyo_night.

Build & install

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
ctest --test-dir build              # plot_gr

plot is header-only — drop include/plot on your include path, or consume it via CMake:

find_package(plot CONFIG REQUIRED)
target_link_libraries(my_app PRIVATE plot::plot)

Releases & the single-header drop

Each tagged release ships prebuilt packages (built by .github/workflows/package.yml):

Platform Artifact
Debian / Ubuntu plot-dev_<ver>_all.deb
RedHat / Fedora plot-devel-<ver>.noarch.rpm
Windows plot-v<ver>-windows.exe (NSIS)
macOS plot-v<ver>-darwin.pkg
any plot-v<ver>-<os>.tar.gz / .zip

The payload is a single amalgamated header plot.hpp (generated from include/plot/ by scripts/amalgamate.py). Once installed — or just dropped in your tree — it is all you need:

#include <plot.hpp>   // no -I plot/, no other files

Regenerate it manually with python3 scripts/amalgamate.py include/plot plot.hpp.

Examples

-DPLOTS_BUILD_EXAMPLES=ON builds the demos under examples/; each writes an .svg:

  • examples/line_chartline_chart.svg
  • examples/scatterscatter.svg
  • examples/heatmapheatmap.svg
  • examples/dashboarddashboard.svg (a 2×2 view/grid figure)

Gallery

Every shipping driver, rendered with the Solarized theme. Each image follows your GitHub color scheme (light or dark) automatically.

Documentation

Full API reference: vargalabs.github.io/plots

License

MIT — see LICENSE.

About

C++23 header only SVG plots

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors