3D vector fields
Visualize velocity, force, or flow vectors at sampled 3D coordinates.
Plotly · Class
go.Cone creates a 3D cone trace for visualizing vector fields. Provide position arrays x, y, z and vector components u, v, w.
Constructing go.Cone creates a graph-object trace for a 3D vector field. Supply matching one-dimensional position arrays x, y, z and vector-component arrays u, v, w; optional attributes control cone sizing, anchoring, and appearance.
plotly.graph_objects.Cone(arg=None, anchor=None, autocolorscale=None, cauto=None, cmax=None, cmid=None, cmin=None, coloraxis=None, colorbar=None, colorscale=None, customdata=None, customdatasrc=None, hoverinfo=None, hoverlabel=None, hovertemplate=None, ids=None, idssrc=None, lighting=None, lightposition=None, meta=None, name=None, opacity=None, reversescale=None, scene=None, showlegend=None, showscale=None, stream=None, text=None, uid=None, uirevision=None, visible=None, x=None, xcalendar=None, xhoverformat=None, xsrc=None, y=None, ycalendar=None, yhoverformat=None, ysrc=None, z=None, zcalendar=None, zhoverformat=None, zsrc=None, **kwargs)| Name | Type | Description |
|---|---|---|
x | array-like | One-dimensional x-coordinate values for cone positions. |
y | array-like | One-dimensional y-coordinate values for cone positions. |
z | array-like | One-dimensional z-coordinate values for cone positions. |
u | array-like | Vector components along the x axis. |
v | array-like | Vector components along the y axis. |
w | array-like | Vector components along the z axis. |
**kwargs | dict | Optional graph-object properties and trace attributes. |
A plotly.graph_objects.Cone trace object.
import plotly.graph_objects as go
fig = go.Figure(go.Cone(
x=[1, 2, 3], y=[1, 2, 3], z=[1, 2, 3],
u=[1, 0, 0], v=[0, 3, 0], w=[0, 0, 2],
sizemode="absolute", sizeref=2, anchor="tip"
))
fig.show()Creates a 3D cone trace from positions and vector components, then displays it.
Visualize velocity, force, or flow vectors at sampled 3D coordinates.
Show direction and relative magnitude of vectors in an interactive scene.
Embed vector-field cones alongside other Plotly 3D traces.
go.Cone is a graph-object trace used to visualize a 3D vector field. It takes three position arrays, x, y, and z, plus three vector-component arrays, u, v, and w.
Follow-up: How can cone size be controlled? Use attributes such as sizemode and sizeref; the official example uses sizemode="absolute" and sizeref=2.
Each cone is positioned at the corresponding x, y, and z values. Its direction and magnitude come from the corresponding u, v, and w vector components.
Follow-up: How would you make the displayed arrows easier to interpret when axes have different scales? Adjust the 3D scene aspect settings so spatial scaling is appropriate.
Create the trace with go.Cone, place it in a Figure's data list, and call fig.show() to render it. Trace attributes can then customize properties such as colors, sizing, and anchoring.
Follow-up: How can an existing cone trace be selected for updates? Use a selector matching selector=dict(type="cone") with update-trace operations.
plotly.graph_objects.Figureplotly.graph_objects.Scatter3dplotly.graph_objects.Streamtube