sdf_xarray.plotting.animate

Contents

sdf_xarray.plotting.animate#

sdf_xarray.plotting.animate(data, fps=10, min_percentile=0, max_percentile=100, title=None, display_sdf_name=False, move_window=False, t=None, ax=None, **kwargs)[source]#

Generate an animation using an xarray.DataArray. The intended use of this function is via sdf_xarray.dataarray_accessor.EpochAccessor.animate.

Parameters:
  • data (DataArray) – DataArray containing the target data

  • fps (float) – Frames per second for the animation

  • min_percentile (float) – Minimum percentile of the data

  • max_percentile (float) – Maximum percentile of the data

  • title (str | None) – Custom title to add to the plot

  • display_sdf_name (bool) – Display the sdf file name in the animation title

  • move_window (bool) – Update the xlim to be only values that are not NaNs at each time interval

  • t (str | None) – Coordinate for t axis (the coordinate which will be animated over). If None, use data.dims[0]

  • ax (Axes | None) – Matplotlib axes on which to plot

  • kwargs – Keyword arguments to be passed to matplotlib

Return type:

FuncAnimation

Examples

>>> anim = ds["Derived_Number_Density_Electron"].epoch.animate()
>>> anim.save("animation.gif")