Graphics & compute

CPlot

Build a plot from a declarative value configuration and named numeric data.

C++23 mc/CPlot.h macOS
#include <mc/CPlot.h>

Link Catalyst::MacShared or Catalyst::MacStatic. Configure pixel width and height, a data map of numeric columns, and a layers vector.

Each layer selects a geom such as "line". Its aes map uses symbols, for example csym("x"), to refer to columns. Literal strings remain literal settings.

Jump to a declaration · 9

CPlot

class CPlot

Types, constants & data

using Float = double;
using Floats = CVector<Float>;

Methods

CPlot

CPlot(const cvar& args);
CPlot(const CPlot&) = delete;

Builds a plot specification from the supplied configuration value. Add or replace named data columns with setData() and call plot() to produce the bitmap; construction alone does not render it.

plot

void plot();

Lays out the configured plot and renders its bitmap. Call again after changing data; use buffer() to access the resulting pixels.

buffer

unsigned char* buffer();

Returns borrowed RGBA pixels, or nullptr before rendering or after invalidation.

setData

void setData(const cstr& name, const Floats& data);

Replaces a named numeric column and invalidates the previous bitmap. Call plot() again before reading pixels.