Skip to main content

CorePlotting::HeatmapMapper

CorePlotting::HeatmapMapper

Converts a grid of scalar rows into colored rectangle batches.

#include <HeatmapMapper.hpp>

Public Functions

Name
RenderableRectangleBatch toRectangleBatch(std::vector< HeatmapRowData > const & rows, Colormaps::ColormapFunction const & colormap, HeatmapColorRange const & color_range ={})
Convert row data to a colored rectangle batch.
RenderableScene buildScene(std::vector< HeatmapRowData > const & rows, Colormaps::ColormapFunction const & colormap, HeatmapColorRange const & color_range ={})
Build a complete RenderableScene from row data.
std::pair< float, float > computeAutoRange(std::vector< HeatmapRowData > const & rows)
Compute the auto color range from row data.

Public Functions Documentation

function toRectangleBatch

static RenderableRectangleBatch toRectangleBatch(
    std::vector< HeatmapRowData > const & rows,
    Colormaps::ColormapFunction const & colormap,
    HeatmapColorRange const & color_range ={}
)

Convert row data to a colored rectangle batch.

Parameters:

  • rows Row data (one per unit/frequency/etc.)
  • colormap Colormap function mapping [0,1] → RGBA
  • color_range Color range configuration

Return: Rectangle batch ready for SceneRenderer

Each [HeatmapRowData](/api_generated/Classes/structCorePlotting_1_1HeatmapRowData.md) becomes one row of the grid. The first row is placed at Y=0, the second at Y=1, etc. Each bin within a row becomes one rectangle cell of height 1.

Color is determined by normalising the scalar value to [0,1] using the specified color range, then evaluating the colormap function.

When color_range.mode == Auto, the range is computed as:

  • vmin = 0 (counts are non-negative)
  • vmax = max value across all rows and bins

When color_range.mode == Symmetric:

  • vmax = max(|value|)
  • vmin = -vmax

function buildScene

static RenderableScene buildScene(
    std::vector< HeatmapRowData > const & rows,
    Colormaps::ColormapFunction const & colormap,
    HeatmapColorRange const & color_range ={}
)

Build a complete RenderableScene from row data.

Parameters:

  • rows Row data (one per unit/frequency/etc.)
  • colormap Colormap function
  • color_range Color range configuration

Return: Complete scene ready for uploadScene()

Convenience that creates the rectangle batch and wraps it in a RenderableScene with identity view/projection matrices (the widget overrides with its own projection).

function computeAutoRange

static std::pair< float, float > computeAutoRange(
    std::vector< HeatmapRowData > const & rows
)

Compute the auto color range from row data.

Parameters:

  • rows Row data to scan

Return: Pair of (vmin, vmax)

Returns {0, max_value} where max_value is the maximum scalar value across all rows and bins. If all values are zero, returns {0, 1}.


Updated on 2026-11-13 at 20:25:42 +0000