Skip to content

HeatmapChart(columns=None, labels=None, scale=ColorScale.VIRIDIS, values=CellValues.HIDDEN) Source

Bases: Chart

Chart drawing each value as a cell colored along a color scale, used by Plot.heatmap.

The columns are side by side and the rows go down from the first one. A color bar next to the cells shows the scale. A missing value leaves its cell light gray.

Added in version 0.1.0

Parameters:

  • columns (list[str] | None, default: None)

    For a Table, the columns drawn, holding numbers. A Table needs it, even for a single column. An Array of one or two dimensions takes none: when omitted, each of its columns is drawn.

  • labels (str | None, default: None)

    For a Table, the column labeling the rows: numbers, dates, datetimes, times of day (labeled HH:MM), texts or booleans, the row numbers when omitted. A row whose label text is missing is left out. An Array takes none, its rows being numbered.

  • scale (ColorScale, default: ColorScale.VIRIDIS)

    The colors of the cells, ColorScale.VIRIDIS by default.

  • values (CellValues, default: CellValues.HIDDEN)

    Whether each cell shows its value, CellValues.HIDDEN by default.

Raises:

Examples:

import numdaplot as ndp

cities = ndp.Array.from_list(["Paris", "Lyon", "Pau"])
january = ndp.Array.from_list([5.5, 3.0, 8.0])
february = ndp.Array.from_list([6.0, 4.5, 9.0])
march = ndp.Array.from_list([9.5, 8.0, 11.5])
temperatures = ndp.Table.from_arrays({"city": cities, "jan": january, "feb": february, "mar": march})
chart = ndp.HeatmapChart(columns=["jan", "feb", "mar"], labels="city", values=ndp.CellValues.SHOWN)
plot = ndp.Plot.heatmap(temperatures, chart)
plot.show()

Plot drawn by the example