You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just in case anyone else comes across this bug, here's the workaround I'm using:
Example workaround
importnumpyasnpimportplotly.graph_objsasgodefgen_color_bar(line_trace):
""" Generates a trace which shows a colorbar based on a line plot. Relevant issue: https://github.com/plotly/plotly.py/issues/1085 """returngo.Scatter3d(
x=line_trace.x, y=line_trace.y, z=line_trace.z,
mode="markers",
marker=go.scatter3d.Marker(
color=line_trace.line.color,
colorscale=line_trace.line.to_plotly_json()["colorscale"], # Waiting on https://github.com/plotly/plotly.py/issues/1087showscale=line_trace.line.showscale,
opacity=0.00000000000001# Make invisible, visible=False disables color bar
),
hoverinfo="none",
showlegend=False
)
# Example usagex, y, z, c=np.random.random_sample((4, 10))
line_trace=go.Scatter3d(
x=x,y=y,z=z,
mode="lines",
line=go.scatter3d.Line(
color=c,
colorscale="Viridis",
showscale=True
),
showlegend=False
)
colorbar_trace=gen_color_bar(line_trace)
go.FigureWidget(data=[
line_trace,
colorbar_trace
])
The option
showscale
forplotly.graph_objects.scatter3d.Line
doesn't make a color scale appear, or seem to do anything. Here's an example:While, for the equivalent marker plot:
The text was updated successfully, but these errors were encountered: