plot_heatmap#

gammapy.visualization.plot_heatmap(data, row_labels, col_labels, ax=None, cbar_kw=None, cbarlabel='', **kwargs)[source]#

Create a heatmap from a numpy array and two lists of labels.

Parameters
data

A 2D numpy array of shape (N, M).

row_labels

A list or array of length N with the labels for the rows.

col_labels

A list or array of length M with the labels for the columns.

ax

A matplotlib.axes.Axes instance to which the heatmap is plotted. If not provided, use current axes or create a new one. Optional.

cbar_kw

A dictionary with arguments to matplotlib.Figure.colorbar. Optional.

cbarlabel

The label for the colorbar. Optional.

**kwargs

All other arguments are forwarded to imshow.