vplot· plotting behind a C ABI

vplot

Publication-quality plotting. No Python, no runtime dependencies.

vplot ports matplotlib's rendering stack to C++23 and exposes it through a pure C header, so the same figure can be exported as PNG/SVG/PDF for a paper or drawn live into an ImGui panel inside a renderer. Because the rasterizer is matplotlib's own, the output is verified pixel-for-pixel against it.

a transcription of matplotlib

The header-only C++ wrapper mirrors matplotlib's API closely enough that porting Python is nearly a transcription — keyword arguments become an options struct, and std::vector or {1, 2, 3} are accepted directly.

// #include "vpl/vpl.hpp"
vplot::Figure fig;               // fig = plt.figure()
auto ax = fig.subplots();        // ax  = fig.subplots()

ax.plot(xs, ys, {.label = "sin"});   // ax.plot(xs, ys, label="sin")
ax.plot(xs, ys2, "r--");             // ax.plot(xs, ys2, "r--")
ax.legend();                         // ax.legend()

fig.savefig("figure.pdf");       // also .svg and .png

what it draws

Every plotting command in matplotlib's headless API surface exists; about two thirds are complete against matplotlib's keyword arguments, and the rest are usable at their defaults. See the per-method coverage.

AreaCommands
Lines & markersplot, scatter, step, stem, stairs, errorbar, format strings
Bars & distributionsbar, barh, hist, boxplot, violinplot, pie, stackplot
Bands & regionsfill_between, fill_betweenx, fill, spans, reference lines
2-D fieldsimshow, matshow, pcolormesh, contour, contourf, hexbin, tripcolor
Vector fieldsquiver, barbs, streamplot
Spectralpsd, csd, cohere, specgram, magnitude/phase/angle spectrum
Axes & layoutlog scales, twin axes, colorbars, subplot grids, tight_layout
OutputRGBA buffer, PNG, SVG, PDF (text as glyph outlines)

run it here

The desktop demo browser is compiled to WebAssembly and drawn through WebGPU or WebGL 2 — the same code that runs on Vulkan, Direct3D 12, and Metal on desktop, via VRI. WebGPU needs a recent Chrome/Edge; WebGL 2 runs everywhere.