xbout.plotting.animate.animate_poloidal

xbout.plotting.animate.animate_poloidal#

xbout.plotting.animate.animate_poloidal(da, *, ax=None, cax=None, animate_over=None, separatrix=True, targets=True, add_limiter_hatching=True, cmap=None, axis_coords=None, vmin=None, vmax=None, logscale=False, animate=True, save_as=None, fps=10, controls='both', aspect=None, extend=None, **kwargs)[source]#

Make a 2D plot in R-Z coordinates using animatplotlib’s Pcolormesh, taking into account branch cuts (X-points).

Parameters:
  • da (xarray.DataArray) – A 2D (x,y) DataArray of data to plot

  • ax (Axes, optional) – A matplotlib axes instance to plot to. If None, create a new figure and axes, and plot to that

  • cax (Axes, optional) – Matplotlib axes instance where the colorbar will be plotted. If None, the default position created by matplotlab.figure.Figure.colorbar() will be used.

  • animate_over (str, optional) – Dimension over which to animate, defaults to the time dimension

  • separatrix (bool, optional) – Add dashed lines showing separatrices

  • targets (bool, optional) – Draw solid lines at the target surfaces

  • add_limiter_hatching (bool, optional) – Draw hatched areas at the targets

  • cmap (matplotlib.colors.Colormap instance, optional) – Colors to use for the plot

  • axis_coords (None, str, dict) –

    Coordinates to use for axis labelling. Only affects time coordinate.

    • None: Use the dimension coordinate for each axis, if it exists.

    • ”index”: Use the integer index values.

    • dict: keys are dimension names, values set axis_coords for each axis separately. Values can be: None, “index”, the name of a 1d variable or coordinate (which must have the dimension given by ‘key’), or a 1d numpy array, dask array or DataArray whose length matches the length of the dimension given by ‘key’.

  • vmin (float, optional) – Minimum value for the color scale

  • vmax (float, optional) – Maximum value for the color scale

  • logscale (bool or float, optional) – If True, default to a logarithmic color scale instead of a linear one. If a non-bool type is passed it is treated as a float used to set the linear threshold of a symmetric logarithmic scale as linthresh=min(abs(vmin),abs(vmax))*logscale, defaults to 1e-5 if True is passed.

  • animate (bool, optional) – If set to false, do not create the animation, just return the blocks

  • save_as (True or str, optional) – If str is passed, save the animation as save_as+’.gif’. If True is passed, save the animation with a default name, ‘<variable name>_over_<animate_over>.gif’

  • fps (float, optional) – Frame rate for the animation

  • controls (string or None, default "both") – By default, add both the timeline and play/pause toggle to the animation. If “timeline” is passed add only the timeline, if “toggle” is passed add only the play/pause toggle. If None or an empty string is passed, add neither.

  • aspect (str or None, optional) – Argument to set_aspect(), defaults to “equal”

  • extend (str or None, optional) – Passed to fig.colorbar()

  • **kwargs (optional) – Additional arguments are passed on to the animation method animatplot.blocks.Pcolormesh

Returns:

If animate==True, returns an animatplot.Animation object, otherwise returns a list of animatplot.blocks.Pcolormesh instances.

Return type:

animation or blocks