dianna.visualization.image

Module Contents

Functions

_determine_vmax(max_data_value)

plot_image(heatmap[, original_data, heatmap_cmap, ...])

Plots a heatmap image.

dianna.visualization.image._determine_vmax(max_data_value)[source]
dianna.visualization.image.plot_image(heatmap, original_data=None, heatmap_cmap=None, heatmap_range=(None, None), data_cmap=None, show_plot=True, output_filename=None)[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).

Returns:

None