postgkyl.pyvista¶
- postgkyl.pyvista(data, *, no_show=False, no_spin=False, max_points_per_axis=-1, contour_levels=10, is_log=False, volume=False, is_shaded=False, hide_axes=False, mesh_clip_plane=False, mesh_slice_plane=False, volume_clip_plane=False, cmin=None, cmax=None, aspect_ratio=(1, 1, 1), camera_azimuth=0.0, camera_elevation=-30.0, opacity='sigmoid_4', cmap='inferno', xlabel=None, ylabel=None, zlabel=None, clabel='', title='', diverging=False, cylindrical_to_cartesian=False, theme='default', saveas='', xscale=1.0, yscale=1.0, zscale=1.0, xshift=0.0, yshift=0.0, zshift=0.0, hide_zeros=False)¶
Render a 3-D scalar field with PyVista.
Builds a structured grid from the (single-component) scalar values and renders it as a volume, contour isosurfaces, or an interactive clip/slice plane. The grid is normalized to
aspect_ratiobecause PyVista handles non-integer axis extents poorly. Only the first value component is used.- Parameters:
data – dataset to plot; must be 3-D (after squeezing any size-1 axis).
no_show – Do not open an interactive render window; render off-screen.
no_spin – Do not auto-rotate the camera in interactive windows.
max_points_per_axis – downsample to at most this many points per axis;
-1disables downsampling.contour_levels – Number of isosurfaces extracted unless
volumeis set.is_log – color by log10 of the scalar (non-positive values masked).
volume – Render a volume instead of isosurface contours.
is_shaded – enable shading on the volume render (volume mode only).
hide_axes – hide the bounding-box axes and labels.
mesh_clip_plane – add an interactive clip plane along
-x.mesh_slice_plane – add an interactive slice plane along
-x.volume_clip_plane – add an interactive volume clip plane (volume mode).
cmin – Color-limit lower bound; defaults to the data minimum.
cmax – Color-limit upper bound; defaults to the data maximum.
aspect_ratio – per-axis aspect the grid is normalized to.
camera_azimuth – Initial camera azimuth in degrees.
camera_elevation – Initial camera elevation in degrees.
opacity – a PyVista opacity preset string,
"diverging"(opaque at both ends, transparent in the middle), or a scalar opacity.cmap – colormap name; overridden to
"RdBu_r"whendiverging.xlabel – Horizontal-axis label; auto-derived when omitted.
ylabel – Vertical-axis label; auto-derived when omitted.
zlabel – Third-axis label; auto-derived when omitted.
clabel – colorbar (scalar bar) title.
title – text drawn at the top of the render; omitted when
None.diverging – use the diverging
"RdBu_r"colormap.cylindrical_to_cartesian – treat grid coordinates as cylindrical
(R, Z, phi)and convert to Cartesian before building the mesh.theme – PyVista plot theme name;
"default"leaves it unchanged.saveas – output path; extension selects the exporter (
.html,.png/.jpg/.jpeg,.pdf/.svg,.gltf,.vtksz). Empty string disables saving.xscale – Multiplicative scale recorded for the horizontal axis.
yscale – Multiplicative scale recorded for the vertical axis.
zscale – Multiplicative scale recorded for the third axis.
xshift – Additive shift applied to the horizontal axis.
yshift – Additive shift applied to the vertical axis.
zshift – Additive shift applied to the third axis.
hide_zeros – hide grid points whose scalar value is exactly zero.
- Returns:
the function renders and/or saves the plot for its side effects.
- Return type:
None
- Raises:
ValueError –
datais not 3-D, orsaveashas an unsupported extension.RuntimeError – PyVista could not obtain a working OpenGL context.