xbout.plotting.plotfuncs.plot2d_wrapper

Contents

xbout.plotting.plotfuncs.plot2d_wrapper#

xbout.plotting.plotfuncs.plot2d_wrapper(da, method, *, ax=None, separatrix=True, targets=True, add_limiter_hatching=True, gridlines=None, cmap=None, norm=None, logscale=None, vmin=None, vmax=None, aspect=None, extend=None, **kwargs)[source]#

Make a 2D plot using an xarray method, taking into account branch cuts (X-points).

Wraps xarray.DataArray.plot methods, so automatically adds labels.

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

  • method (xarray.plot.*) – An xarray plotting method to use

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

  • 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

  • gridlines (bool, int or slice or dict of bool, int or slice, optional) – If True, draw grid lines on the plot. If an int is passed, it is used as the stride when plotting grid lines (to reduce the number on the plot). If a slice is passed it is used to select the grid lines to plot. If a dict is passed, the ‘x’ entry (bool, int or slice) is used for the radial grid-lines and the ‘y’ entry for the poloidal grid lines.

  • cmap (Matplotlib colormap, optional) – Color map to use for the plot

  • norm (matplotlib.colors.Normalize instance, optional) – Normalization to use for the color scale. Cannot be set at the same time as ‘logscale’

  • 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. Cannot be set at the same time as ‘norm’

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

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

  • aspect (str or float, optional) – Passed to ax.set_aspect(). By default ‘equal’ is used.

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

  • levels (int or iterable, optional) – Only used by contour or contourf, sets the number of levels (if int) or the level values (if iterable)

  • **kwargs (optional) – Additional arguments are passed on to method

Returns:

List of the artist instances

Return type:

artists