Slicer plot#

The slicer plot is designed to provide sliders to slice higher dimensions of the data in an interactive way.

This is used for example in the case of having a 3 dimensional data cube, and wanting to display it as a 2 dimensional image, with a slider to navigate the third dimension.

[1]:
%matplotlib widget
import plopp as pp

da = pp.data.data3d()

The slicer function needs a list of dimensions that are to be kept (all remaining dims will be sliced):

[2]:
pp.slicer(da, keep=['x', 'y'])
[2]:

Keeping only a single dimension will produce a 1 dimensional plot:

[3]:
pp.slicer(da, keep=['x'])
[3]:

Autoscale behaviour#

By default, when updating the values by interacting with the slider, the canvas and the color scale will automatically adjust to the displayed data. This is also the case if you have zoomed in on a region of the plot, and move the slider; the axes will reset to the data range (most likely losing the zoom window).

To disable the autoscaling, you can set autoscale=False, which disables axes and color scaling.

[4]:
pp.slicer(da * da.coords['z'], keep=['x'], autoscale=False)
[4]:

When in autoscale=False mode, clicking the home button f49a3c1411df409c9e8d9d67fd7541fa can be used for manually fitting the axes and color scale to the data.

Animate the sliders#

353244c05f33468687e14a74a8c66ca3   New in version 25.07.0.

It is possible to display some animation controls (play button) next to the slider, by using the enable_player=True option:

[5]:
pp.slicer(da, keep=['x', 'y'], enable_player=True)
[5]:

Can I have a 3D plot with a slider?#

3D plots are not supported out of the box by the plopp.slicer function, but it is still possible to create them.

An example in the gallery shows you how to do this.