desc.plotting.plot_basis

desc.plotting.plot_basis(basis, return_data=False, **kwargs)[source]

Plot basis functions.

Parameters:
  • basis (Basis) – basis to plot

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

Returns:

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

  • ax (matplotlib.axes.Axes, ndarray of axes, or dict of axes) – Axes used for plotting. A single axis is used for 1d basis functions, 2d or 3d bases return an ndarray or dict of axes. return_data : bool if True, return the data plotted as well as fig,ax

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

    ”rho”, “theta”, “zeta”: varies, what coordinate(s) the basis depends on

    FourierSeries will return “zeta” PowerSeries will return “rho” DoubleFourierSeries will return “theta”,”zeta” FourierZernike and ZernikePolynomial return “rho”,”theta” (FourierZernike only plotted at zeta=0 plane)

    ”l”,”m”,”n”: basis radial, poloidal, and toroidal modenumbers

    FourierSeries will return “n” PowerSeries will return “l” DoubleFourierSeries will return “m”,”n” FourierZernike and ZernikePolynomial return “l”,”m” (FourierZernike only plotted at zeta=0 plane)

    ”amplitude”: the amplitude of the basis functions

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

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

    plot_X(figsize=(4,6))
    

    Valid keyword arguments are:

    figsize: tuple of length 2, the size of the figure (to be passed to matplotlib) cbar_ratio: float title_ratio: float cmap: str, matplotib colormap scheme to use, passed to ax.contourf title_font_size: integer, font size of the title

Examples

../../_images/plot_basis.png
from desc.plotting import plot_basis
from desc.basis import DoubleFourierSeries
basis = DoubleFourierSeries(M=3, N=2)
fig, ax = plot_basis(basis)