desc.plotting.plot_section

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

Plot Poincare 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),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.

    cmap: str, matplotib colormap scheme to use, passed to ax.contourf levels: int or array-like, passed to contourf nzeta: int, number of equispaced zeta planes to plot sections at (default 1

    for axisymmetry and 6 for non-axisymmetry)

    title_font_size: integer, font size of the title 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:

    ”R”,”Z” cylindrical coordinates key of the 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_section.png
from desc.plotting import plot_section
fig, ax = plot_section(eq, "J^rho")