Open In App
Related Articles

3D Cone Plots using Plotly in Python

Improve Article
Save Article
Like Article

Plotly is a Python library that is used to design graphs, especially interactive graphs. It can plot various graphs and charts like histogram, barplot, boxplot, spreadplot, and many more. It is mainly used in data analysis as well as financial analysis. plotly is an interactive visualization library.

3D Cone Plot in Plotly

In plotly, a cone plot is a plot that has 3d equivalent of a 2D quiver plot. A 3d vector represents the direction and norm of the vectors.

  • 3d coordinates are X, Y, and Z which define the coordinates for a vector.
  • 3d coordinates of a vector field are  U, V, and W which is defined as the vector field.

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, hoverinfosrc=None, hoverlabel=None, hovertemplate=None, hovertemplatesrc=None, hovertext=None, hovertextsrc=None, ids=None, idssrc=None, legendgroup=None, lighting=None, lightposition=None, meta=None, metasrc=None, name=None, opacity=None, reversescale=None, scene=None, showlegend=None, showscale=None, sizemode=None, sizeref=None, stream=None, text=None, textsrc=None, u=None, uid=None, uirevision=None, usrc=None, v=None, visible=None, vsrc=None, w=None, wsrc=None, x=None, xsrc=None, y=None, ysrc=None, z=None, zsrc=None, **kwargs)


u – Sets the x components of the vector field.

v – Sets the y components of the vector field.

w – Sets the z components of the vector field.

x – Sets the x coordinates of the vector field and of the displayed cones.

y – Sets the y coordinates of the vector field and of the displayed cones.

z – Sets the z coordinates of the vector field and of the displayed cones.



import plotly.graph_objects as go
fig = go.Figure(data=go.Cone(x=[3],


Plotting Multiple 3D Cones

In plotly, the multiple 3d cones use the parameter scene, in this the graph show many cones in a single graph that help to differentiate between each other. It can be created by passing multiple values in the x, y, z, u, v, w parameters.

Example 1:


import plotly.graph_objects as go
fig = go.Figure(data=go.Cone(x=[1,3], 


Example 2:


import plotly.graph_objects as go
fig = go.Figure(data=go.Cone(x=[11,31, 12], 
                             y=[12,32, 21],
                             z=[13,41, 15],
                             u=[14,16, 17],
                             v=[15,27, 10],
                             w=[10,29, 21]))


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 10 Jul, 2020
Like Article
Save Article
Similar Reads
Complete Tutorials