desc.plotting.plot_3d
- desc.plotting.plot_3d(eq, name, grid=None, log=False, all_field_periods=True, ax=None, return_data=False, **kwargs)[source]
Plot 3D surfaces.
- 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.
all_field_periods (bool, optional) – Whether to plot full torus or one field period. Ignored if grid is specified.
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) component: str, one of [None, ‘R’, ‘phi’, ‘Z’], For vector variables, which
element to plot. Default is the norm of the vector.
alpha: float btwn [0,1.0], the transparency of the plotted surface title_font_size: integer, font size of the title elev: float, elevation orientation angle of 3D plot (in the z plane) azim: float, azimuthal orientation angle of 3D plot (in the x,y plane) dist: float, distance from the camera to the center point of the plot xlabel_fontsize: float, fontsize of the xlabel ylabel_fontsize: float, fontsize of the ylabel zlabel_fontsize: float, fontsize of the zlabel
- 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:
”X”,”Y”,”Z”, cartesian coordinates key of the name of variable plotted
Examples
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, ax = plot_3d(eq, "|F|", log=True, grid=grid)