Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Plotly · Class

go.Cone

go.Cone creates a 3D cone trace for visualizing vector fields. Provide position arrays x, y, z and vector components u, v, w.

How it works

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.

Syntax

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)

Parameters

NameTypeDescription
xarray-likeOne-dimensional x-coordinate values for cone positions.
yarray-likeOne-dimensional y-coordinate values for cone positions.
zarray-likeOne-dimensional z-coordinate values for cone positions.
uarray-likeVector components along the x axis.
varray-likeVector components along the y axis.
warray-likeVector components along the z axis.
**kwargsdictOptional graph-object properties and trace attributes.

Returns

A plotly.graph_objects.Cone trace object.

Key points

  • Use this trace type when a 3D vector field is best communicated with oriented cones.
  • The vector field input consists of six one-dimensional arrays: three coordinates and three vector components.
  • u, v, and w provide the vector components associated with those locations.

Example: Basic vector-field cone plot

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.

When to use it

3D vector fields

Visualize velocity, force, or flow vectors at sampled 3D coordinates.

Directional data exploration

Show direction and relative magnitude of vectors in an interactive scene.

Combined 3D figures

Embed vector-field cones alongside other Plotly 3D traces.

Interview questions

QWhat data does go.Cone require to represent a vector field?

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.

QHow are cone positions and vectors mapped?

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.

QHow is a Cone trace displayed and customized in Plotly?

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.Figure
  • plotly.graph_objects.Scatter3d
  • plotly.graph_objects.Streamtube

Source: plotly.graph_objects.Cone — 6.5.0 documentation. Checked 2026-10-15.