xbout.plotting.plotfuncs.plot3d

Contents

xbout.plotting.plotfuncs.plot3d#

xbout.plotting.plotfuncs.plot3d(da, style='surface', engine='k3d', levels=None, outputgrid=(100, 100, 25), color_map=None, colorbar=True, colorbar_font_size=None, plot=None, save_as=None, surface_xinds=None, surface_yinds=None, surface_zinds=None, fps=20.0, mayavi_figure=None, mayavi_figure_args=None, mayavi_view=None, **kwargs)[source]#

Make a 3d plot

Warning

3d plotting functionality is still a bit of a work in progress. Bugs are likely, and help developing is welcome!

Parameters:
  • style ({'surface', 'poloidal planes'}) – Type of plot to make: - ‘surface’ plots the outer surface of the DataArray - ‘poloidal planes’ plots each poloidal plane in the DataArray

  • engine ({'k3d', 'mayavi'}) – 3d plotting library to use

  • levels (sequence of (float, float)) – For isosurface, the pairs of (level-value, opacity) to plot

  • outputgrid ((int, int, int) or None, optional) – For isosurface or volume plots, the number of points to use in the Cartesian (X,Y,Z) grid, that data is interpolated onto for plotting. If None, then do not interpolate and treat “bout_xdim”, “bout_ydim” and “bout_zdim” coordinates as Cartesian (useful for slab simulations).

  • color_map (k3d color map, optional) – Color map for k3d plots

  • colorbar (bool or dict, default True) – Add a color bar. If a dict is passed, it is passed on to the colorbar() function as keyword arguments.

  • colorbar_font_size (float, default None) – Set the font size used by the colorbar (for engine=”mayavi”)

  • plot (k3d plot instance, optional) – Existing plot to add new plots to

  • save_as (str) – Filename to save figure to. Animations will be saved as a sequence of numbered files.

  • surface_xinds ((int, int), default None) – Indices to select when plotting radial surfaces. These indices are local to the region being plotted, so values will be strange. Recommend using values relative to the radial boundaries (i.e. positive for inner boundary and negative for outer boundary).

  • surface_yinds ((int, int), default None) – Indices to select when plotting poloidal surfaces. These indices are local to the region being plotted, so values will be strange. Recommend using values relative to the poloidal boundaries (i.e. positive for lower boundaries and negative for upper boundaries).

  • surface_zinds ((int, int), default None) – Indices to select when plotting toroidal surfaces

  • fps (float, default 20) – Frames per second to use when creating an animation.

  • mayavi_figure (mayavi.core.scene.Scene, default None) – Existing Mayavi figure to add this plot to.

  • mayavi_figure_args (dict, default None) – Arguments to use when creating a new Mayavi figure. Ignored if mayavi_figure is passed.

  • mayavi_view ((float, float, float), default None) – If set, arguments are passed to mayavi.mlab.view to set the view when engine="mayavi"

  • vmin (float) – vmin and vmax are treated specially. If a float is passed, then it is used for vmin/vmax. If the arguments are not passed, then the minimum and maximum of the data are used. For an animation, to get minimum and/or maximum calculated separately for each frame, pass vmin=None and/or vmax=None explicitly.

  • vmax (float) – vmin and vmax are treated specially. If a float is passed, then it is used for vmin/vmax. If the arguments are not passed, then the minimum and maximum of the data are used. For an animation, to get minimum and/or maximum calculated separately for each frame, pass vmin=None and/or vmax=None explicitly.

  • **kwargs – Extra keyword arguments are passed to the backend plotting function