ArrayAnimator

class sunpy.visualization.animator.ArrayAnimator(data, image_axes=[-2, -1], axis_ranges=None, **kwargs)[source] [edit on github]

Bases: sunpy.visualization.animator.BaseFuncAnimator

Create a Matplotlib backend independent data explorer.

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 BaseFuncAnimator.

Attributes Summary

frame_index

A tuple version of frame_slice to be used when indexing arrays.

Methods Summary

label_slider(i, label)

Change the Slider label.

plot_start_image()

Abstract method for plotting first slice of array.

update_plot(val, artist, slider)

Abstract method for updating the plot.

Attributes Documentation

frame_index

A tuple version of frame_slice to be used when indexing arrays.

Methods Documentation

label_slider(i, label)[source] [edit on github]

Change the Slider label.

Parameters
  • i (int) – The index of the slider to change (0 is bottom).

  • label (str) – The label to set.

abstract plot_start_image()[source] [edit on github]

Abstract method for plotting first slice of array.

Must exist here but be defined in subclass.

abstract update_plot(val, artist, slider)[source] [edit on github]

Abstract method for updating the plot.

Must exist here but be defined in subclass.