desc.plotting.plot_3d

desc.plotting.plot_3d(eq, name, grid=None, log=False, fig=None, return_data=False, **kwargs)Source

Plot 3D surfaces.

Parameters:
  • eq (Equilibrium, Surface) – 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.

  • fig (plotly.graph_objs._figure.Figure, optional) – Figure to plot on

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

  • **kwargs (dict, optional) –

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

    plot_X(figsize=(4,6), cmap="RdBu")
    

    Valid keyword arguments are:

    • figsize: tuple of length 2, the size of the figure in inches

    • component: str, one of [None, ‘R’, ‘phi’, ‘Z’], For vector variables, which element to plot. Default is the norm of the vector.

    • title: title to add to the figure.

    • cmap: string denoting colormap to use.

    • levels: array of data values where ticks on colorbar should be placed.

    • alpha: float in [0,1.0], the transparency of the plotted surface

Returns:

  • fig (plotly.graph_objs._figure.Figure) – Figure being plotted to

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

Examples

../../_images/plot_3d.png
from desc.plotting import plot_3d
from desc.grid import LinearGrid
grid = LinearGrid(
        rho=0.5,
        theta=np.linspace(0, 2 * np.pi, 100),
        zeta=np.linspace(0, 2 * np.pi, 100),
        axis=True,
    )
fig = plot_3d(eq, "|F|", log=True, grid=grid)