desc.plotting.plot_2d

desc.plotting.plot_2d(eq, name, grid=None, log=False, norm_F=False, ax=None, return_data=False, **kwargs)[source]

Plot 2D cross-sections.

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

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

  • grid (Grid, optional) – Grid of coordinates to plot at.

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

  • norm_F (bool, optional) – Whether to normalize a plot of force error to be unitless. Vacuum equilibria are normalized by the gradient of magnetic pressure, while finite beta equilibria are normalized by 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),cmap="plasma")
    

    Valid keyword arguments are:

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

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

    cmap: str, matplotib colormap scheme to use, passed to ax.contourf levels: int or array-like, passed to contourf xlabel_fontsize: float, fontsize of the xlabel ylabel_fontsize: float, fontsize of the ylabel

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:

    two of “rho”,”theta” or “zeta”, depending on what 1-D variable

    is plotted against.

    ”normalization”: normalization used in the plot,

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

    key of the name of variable plotted.

Examples

../../_images/plot_2d.png
from desc.plotting import plot_2d
plot_2d(eq, 'sqrt(g)')