Black Lives Matter. Please consider donating to Black Girls Code today.

Default uniform color for surface plot, cone plot , etc

Hi there,

I was wondering if there is a way to let plotly automatically choose a default uniform color for Cone or Surface plots like it does for Mesh3d ?

I know I can specify colorscale with min=max but then I have to specify the color explicitly, to differentiate multiple traces.
I also know I could use PLOTLY_DEFAULT_COLORS but this implies that I know the trace index, which in my case is not available at trace creation time.

I guess this would need to happen at the javascript library level, but maybe there is a trick to make it possible in python.


Alex -

Here an example with cones

from plotly import graph_objects as go
color1 = 'blue'
color2 = 'red'
fig = go.Figure()
fig.add_cone(x=[1], y=[1], z=[1], u=[-1], v=[1], w=[1], 
             colorscale=[[0, color1], [1,color1]],
fig.add_cone(x=[3], y=[1], z=[1], u=[-1], v=[1], w=[1], 
             colorscale=[[0, color2], [1,color2]],



Unfortunately there is no color property for go.Surface or go.Cone, hence at the moment you have only the solution of defining a colorscale, as you did in the code above.