Scientific volume rendering
Inspect a simulated or measured scalar field in three dimensions.
Plotly · Class
A Volume trace renders a scalar field as partially transparent 3-D isosurfaces. Supply x, y, z coordinates and a value for every vertex, then control bounds, opacity, slices, caps, and spaceframe rendering.
Volume constructs a 3-D volume trace from one-dimensional coordinate arrays and a scalar value for every grid vertex. It renders isosurfaces between selected minimum and maximum values, with optional transparency, slices, caps, and a spaceframe.
plotly.graph_objects.Volume(arg=None, autocolorscale=None, caps=None, cauto=None, cmax=None, cmid=None, cmin=None, coloraxis=None, colorbar=None, colorscale=None, hoverinfo=None, hoverinfosrc=None, hoverlabel=None, hovertemplate=None, hovertext=None, ids=None, idssrc=None, isomax=None, isomin=None, isosurface=None, legend=None, meta=None, metasrc=None, name=None, opacity=None, opacityscale=None, reversescale=None, scene=None, showlegend=None, showscale=None, surface=None, surface_count=None, text=None, uid=None, uirevision=None, value=None, valuehoverformat=None, visible=None, x=None, xhoverformat=None, y=None, yhoverformat=None, z=None, zhoverformat=None, **kwargs)| Name | Type | Description |
|---|---|---|
arg | dict or plotly.graph_objects.Volume | Dictionary of constructor-compatible properties or an existing Volume instance. |
autocolorscale | bool | Whether to use a default palette rather than the colorscale property. |
slices | plotly.graph_objects.volume.Slices or dict | Configuration for horizontal or vertical slices. |
caps | plotly.graph_objects.volume.Caps or dict | Configuration for caps on the volume. |
spaceframe | plotly.graph_objects.volume.Spaceframe or dict | Configuration for the spaceframe. |
text | str or array-like | Text associated with vertices. |
value | array-like | Scalar values assigned to vertices. |
x | array-like | X coordinates of vertices. |
y | array-like | Y coordinates of vertices. |
z | array-like | Z coordinates of vertices. |
kwargs | dict | Additional supported trace properties. |
A plotly.graph_objects.Volume trace object.
import numpy as np
import plotly.graph_objects as go
x, y, z = np.mgrid[-1:1:15j, -1:1:15j, -1:1:15j]
value = np.exp(-(x**2 + y**2 + z**2))
fig = go.Figure(go.Volume(
x=x.ravel(), y=y.ravel(), z=z.ravel(), value=value.ravel(),
isomin=0.2, isomax=0.8, opacity=0.1, surface_count=12
))
fig.show()Creates a runnable interactive volume rendering from a regular 3-D scalar field.
Inspect a simulated or measured scalar field in three dimensions.
Show internal thresholds or layers in a volumetric dataset.
Reveal selected cross-sections through a 3-D field.
Provide an outlined spatial context around rendered values.
Volume is a graph-object trace for rendering a scalar field in three dimensions. The coordinates and values are supplied as four one-dimensional arrays, and the trace draws isosurfaces between iso-min and iso-max.
Follow-up: How can depth perception be improved? Use opacityscale together with opacity so scalar values map to different transparency levels.
The x, y, and z arrays provide vertex coordinates, while value provides the fourth, scalar dimension associated with each vertex. These arrays describe either a uniform or non-uniform 3-D grid.
Follow-up: What must be checked when preparing data? Ensure the coordinate and value arrays describe corresponding vertices and have compatible lengths.
surface_count controls how many isosurfaces are drawn between the minimum and maximum iso-values. Its documented default is 2, which draws only the minimum and maximum surfaces.
Follow-up: How would you add internal views? Configure slices, caps, or the spaceframe properties on the trace.
plotly.graph_objects.Isosurfaceplotly.graph_objects.volume.Capsplotly.graph_objects.volume.Slicesplotly.graph_objects.volume.Spaceframeplotly.graph_objects.volume.Surface