Heatmap

API Reference

Note

This plot can be saved in an interactive form, see Saving plots

Visualize numerical arrays in the form of a heatmap. Also used for visualization of Hierarchical clusterting dendrograms. Datapoint Tracer is embedded.

Layout

Left: The heatmap. Clicking the heatmap highlights the selected row and upates the Datapoint Tracer. Right click on the heatmap to clear the selection highlight on the heatmap. You can zoom and pan the heatmap using the tools above the plot area. You can zoom/pan in the legend and heatmap. The up and down keys on your keyboard can be used to move the current row selection.

Bottom left: Set the row order of the heatmap according to a categorical column.

Middle: Plot controls.

Very bottom: Status label - displays any issues that were raised while setting the plot data. Click on the status label to see more information.

Parameters

Data column: Data column, numerical arrays, that contain the data for the heatmap. Each row of this data column (a 1D array) is represented as a row on the heatmap.

Labels column: Column containing categorical labels that are used to create the row legend for the heatmap.

DPT curve column: Data column, containing numerical arrays, that is shown in the Datapoint Tracer.

Data colormap: Colormap used for representing the data in the heatmap. Default is ‘jet’.

Legend colormap: Colormap used for the row legend.

Live update from input transmission: If checked this plots receives live updates from the flowchart.

Plot: Updates data input from the flowchart.

Save: Save the plot data and state in an interactive form <save_ptrn>

Load: Load a plot that has been saved as a “.ptrn” file.

Layout to visualize Hierarchical Clustering

This plot widget can also be used to visualize a dendrogram on top of a heatmap of data.

The differences are:

  1. There are two legend bars

    • Left: Cluster label
    • Right: Corresponds to Labels column parameter.
  2. You can also zoom/pan the dendrogram in addition to the legends and heatmap.

  3. Sorting the heatmap rows is disabled because this wouldn’t make sense

Console

You can directly access the heatmap widget through the console. This is useful for plot customization and exporting with specific parameters.

Toggle the console’s visibility by clicking on the “Show/Hide Console” button at the bottom of the controls.

Namespace

reference Description
this The higher-level HeatmapTracerWidget instance, i.e. the entire widget
get_plot_area() Returns the lower-level Heatmap variant instance, basically the actual plot area
get_plot() Returns the seaborn ClusterGrid instance containing the axes
get_fig() Returns the matplotlib Figure instance

Example

Export as an SVG with specific dimensions and DPI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Desired size (width, height)
size = (2.0, 2.5)

# original size to reset the figure after we save it
orig_size = fig.get_size_inches()

# Get the figure
fig = get_fig()

#Set the desired size
fig.set_size_inches(size)

# Save the figure as an svg file with 600 dpi
fig.savefig('/share/data/temp/kushal/amazing_heatmap.svg', dpi=600)

# Reset the figure size
fig.set_size_inches(orig_size)

Note

The entire plot area might go gray after the figure is reset to the original size. I suspect this is a Qt-matplotlib issue. Simply resize the window a bit and the plot will be visible again!