ImageAnimator#

class mpl_animators.ImageAnimator(data, image_axes=[-2, -1], axis_ranges=None, **kwargs)[source]#

Bases: ArrayAnimator

Create a matplotlib backend independent data explorer for 2D images.

The following keyboard shortcuts are defined in the viewer:

  • ‘left’: previous step on active slider.

  • ‘right’: next step on active slider.

  • ‘top’: change the active slider up one.

  • ‘bottom’: change the active slider down one.

  • ‘p’: play/pause active slider.

This viewer can have user defined buttons added by specifying the labels and functions called when those buttons are clicked as keyword arguments.

Parameters:
  • data (numpy.ndarray) – The data to be visualized.

  • image_axes (list, optional) – A list of the axes order that make up the image.

  • axis_ranges (list of physical coordinates for the numpy.ndarray, optional) – Defaults to None and array indices will be used for all axes. The list should contain one element for each axis of the numpy.ndarray. For the image axes a [min, max] pair should be specified which will be passed to matplotlib.pyplot.imshow as an extent. For the slider axes a [min, max] pair can be specified or an array the same length as the axis which will provide all values for that slider.

Notes

Extra keywords are passed to ArrayAnimator.

Methods Summary

plot_start_image(ax)

Sets up plot of initial image.

update_plot(val, im, slider)

Updates plot based on slider/array dimension being iterated.

Methods Documentation

plot_start_image(ax)[source]#

Sets up plot of initial image.

update_plot(val, im, slider)[source]#

Updates plot based on slider/array dimension being iterated.