Compare Slices of 2D Arrays¶
Note
Unfortunately the interactive plots won’t work on a website as there is no Python kernel running. So all the interactive outputs have been replaced by gifs of what you should expect.
The heatmap_slicer()
function allow you to compare horizontal and/or vertical
slices of an arbitrary number of 2D arrays with just your mouse.
x = np.linspace(0, np.pi, 100)
y = np.linspace(0, 10, 200)
X,Y = np.meshgrid(x, y)
data1 = np.sin(X) + np.exp(np.cos(Y))
data2 = np.cos(X) + np.exp(np.sin(Y))
fig, axes = heatmap_slicer(x, y, (data1,data2),slices='both',
heatmap_names=('dataset 1','dataset 2'),
labels=('Some wild X variable','Y axis'),
interaction_type='move')

Options¶
The interaction_type
argument controls how the plot updates. You can either use
'move'
in which case all mouse movements will be tracked, or you can use 'click'
and then the plot will only update when you click on one the arrays.
The slices
argument controls which slices to compare. It accepts values of 'vertical'
, 'horizontal'
and 'both'
Potential Improvements¶
Do you wish the heatmap_slicer was better or general? Then you should consider helping out on one of the open issues for improving it!