desc.plotting.plot_comparison

desc.plotting.plot_comparison(eqs, rho=8, theta=8, zeta=None, ax=None, cmap='rainbow', colors=None, lws=None, linestyles=None, labels=None, return_data=False, **kwargs)[source]

Plot comparison between flux surfaces of multiple equilibria.

Parameters:
  • eqs (array-like of Equilibrium or EquilibriaFamily) – Equilibria to compare.

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

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

  • zeta (int or array-like or None) – Values of zeta to plot contours at. If an integer, plot that many contours linearly spaced in [0,2pi). Default is 1 contour for axisymmetric equilibria or 6 for non-axisymmetry.

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

  • cmap (str or matplotlib ColorMap) – Colormap to use for plotting, discretized into len(eqs) colors.

  • colors (array-like) – Array the same length as eqs of colors to use for each equilibrium. Overrides cmap.

  • lws (array-like) – Array the same length as eqs of line widths to use for each equilibrium

  • linestyles (array-like) – Array the same length as eqs of linestyles to use for each equilibrium.

  • labels (array-like) – Array the same length as eqs of labels to apply to each equilibrium.

  • 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) legend: bool, whether to display legend or not legend_kw: dict, any keyword arguments to be pased to ax.legend() 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: Each are a list of len(eqs) corresponding to each eq input

    ”rho_R_coords”,”rho_Z_coords”, Cylindrical R,Z coordinates of rho contours “vartheta_R_coords”, “vartheta_Z_coords”,

    Cylindrical R,Z coordinates of vartheta contours

Examples

../../_images/plot_comparison.png
from desc.plotting import plot_comparison
fig, ax = plot_comparison(eqs=[eqf[0],eqf[1],eqf[2]],
                          labels=['Axisymmetric w/o pressure',
                                  'Axisymmetric w/ pressure',
                                  'Nonaxisymmetric w/ pressure',
                                 ],
                         )