Signalsmith's Basic C++ Plots  1.1.0
A minimal C++ plotting library
Files | Classes
PNG Heat-Maps

Description

Bitmap heat-maps saved as PNGs.

This is an optional module, allowing you to add pixel-based heat-maps to your plots. You create a heat-map, change its .scale (which is an Axis) and values:

signalsmith::plot::HeatMap heatMap(width, height);
heatMap.scale.linear(-10, 10); // dark to light
// Access/modify pixels
heatMap(x, y) = 5;
heatMap.write("out.png");
Pixel-based heat-map.
Definition: heatmap.h:68

You can add it to an existing Plot2D:

// Takes up the entire plot by default, vertically flipped by default
heatMap.addTo(plot);
// You can also give it a specific position and size
heatMap.addTo(plot, {leftX, rightX, topX, bottomX});

You can pass in a second Plot2D, which will be taken over as a "scale" plot, including any ticks/label from heatMap.scale:

auto &plot = grid(0, 0).plot(200, 200);
auto &scalePlot = grid(1, 0).plot(20, 200);
heatMap.addTo(plot, scalePlot);
Definition: plot.h:1744

You can also add it to a Grid (e.g. a Figure), which will create two sub-plots (data and scale). All .addTo() methods return the data plot, so you can inline things a bit:

auto &plot = heatMap.addTo(figure, 200, 200);

Files

file  heatmap.h
 

Classes

struct  signalsmith::plot::HeatMap
 Pixel-based heat-map. More...