desc.plotting.plot_fsa

desc.plotting.plot_fsa(eq, name, with_sqrt_g=True, log=False, rho=20, M=None, N=None, norm_F=False, ax=None, return_data=False, **kwargs)[source]

Plot flux surface averages of quantities.

Parameters:
  • eq (Equilibrium) – Object from which to plot.

  • name (str) – Name of variable to plot.

  • with_sqrt_g (bool, optional) –

    Whether to weight the surface average with sqrt(g), the 3-D Jacobian determinant of flux coordinate system. Default is True.

    The weighted surface average is also known as a flux surface average. The unweighted surface average is also known as a theta average.

    Note that this boolean has no effect for quantities which are defined as surface functions because averaging such functions is the identity operation.

  • log (bool, optional) – Whether to use a log scale.

  • rho (int or array-like) – Values of rho to plot contours of. If an integer, plot that many contours linearly spaced in (0,1).

  • M (int, optional) – Poloidal grid resolution. Default is eq.M_grid.

  • N (int, optional) – Toroidal grid resolution. Default is eq.N_grid.

  • norm_F (bool, optional) – Whether to normalize a plot of force error to be unitless. Vacuum equilibria are normalized by the volume average of the gradient of magnetic pressure, while finite beta equilibria are normalized by the volume average of the pressure gradient.

  • ax (matplotlib AxesSubplot, optional) – Axis to plot on.

  • return_data (bool) – if True, return the data plotted as well as fig,ax

  • **kwargs (fig,ax and plotting properties) –

    Specify properties of the figure, axis, and plot appearance e.g.:

    plot_X(figsize=(4,6),label="your_label")
    

    Valid keyword arguments are:

    figsize: tuple of length 2, the size of the figure (to be passed to matplotlib) component: str, one of [None, ‘R’, ‘phi’, ‘Z’], For vector variables, which

    element to plot. Default is the norm of the vector.

    label: str, label of the plotted line (e.g. to be shown with ax.legend()) xlabel_fontsize: float, fontsize of the xlabel ylabel_fontsize: float, fontsize of the ylabel linecolor: str or tuple, color to use for plot line ls: str, linestyle to use for plot line lw: float, linewidth to use for plot line

Returns:

  • fig (matplotlib.figure.Figure) – Figure being plotted to.

  • ax (matplotlib.axes.Axes or ndarray of Axes) – Axes being plotted to.

  • plot_data (dict) – dictionary of the data plotted only returned if return_data=True plot_data keys:

    ”rho” “<name>_fsa” where name is the passed name of variable plotted “normalization”: normalization used in the plot,

    if norm_F=False or F is not plotted, this is just equal to 1.

Examples

../../_images/plot_fsa.png
from desc.plotting import plot_fsa
fig, ax = plot_fsa(eq, "B_theta", with_sqrt_g=False)