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.VIRIDISby default. -
values(CellValues, default:CellValues.HIDDEN)Whether each cell shows its value,
CellValues.HIDDENby default.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
InvalidColumnNameErrorWhen
labelsor a name incolumnsis an empty text. -
EmptyListErrorWhen
columnsis an empty list. -
DuplicateColumnErrorWhen a column name appears twice in
columns.
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()