dianna.visualization.image
Functions
|
|
|
Plots a heatmap image. |
Module Contents
- dianna.visualization.image.plot_image(heatmap: numpy.ndarray, original_data: numpy.ndarray | None = None, heatmap_cmap='bwr', heatmap_range=(None, None), data_cmap=None, show_plot: bool = True, output_filename=None, ax: matplotlib.pyplot.Axes | None = None) matplotlib.pyplot.Figure[source]
Plots a heatmap image.
Optionally, the heatmap (typically a saliency map of an explainer) can be plotted on top of the original data. In that case both images are plotted transparantly with alpha = 0.5.
- Parameters:
heatmap – the saliency map or other heatmap to be plotted.
original_data – the data to plot together with the heatmap, both with alpha = 0.5 (optional).
heatmap_cmap – color map for the heatmap plot (see mpl.Axes.imshow documentation for options).
heatmap_range – a tuple (vmin, vmax) to set the range of the heatmap. By default, the colormap covers the complete value range of the supplied heatmap.
data_cmap – color map for the (optional) data image (see mpl.Axes.imshow documentation for options). By default, if the image is two dimensional, the color map is set to ‘gray’.
show_plot – Shows plot if true (for testing or writing plots to disk instead).
output_filename – Name of the file to save the plot to (optional).
ax – matplotlib.Axes object to plot on (optional).
- Returns:
None