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
When adding a shape to a legendgroup with showlegend=False, he does not toggle the visibility when clicking in the legend which is inconsistent with the expected behaviour of traces.
Here is the code to reproduce the graph.
Plotly version: 5.17.0
I added another example below. The expected behavior works for the traces group; you click it and both traces turn off even though only one trace is actually in the legend. For the shapes, if you click the group, only the first shape turns invisible.
import plotly.graph_objects as go
# Make example traces.
traces = []
for i in range(2):
trace = go.Scatter(
x=[i, i + 1],
y=[i, i + 1],
name=f'Traces Group',
legendgroup='traces_group',
showlegend=True if i == 0 else False
)
traces.append(trace)
# Make example shapes.
shapes = []
for i in range(2):
shape = dict(
type='rect',
x0=i,
x1=i+1,
name='Shapes Group',
showlegend=True if i == 0 else False,
)
shapes.append(shape)
# Make and show figure.
fig = go.Figure(
traces,
layout=dict(shapes=shapes),
)
fig.show()
Indeed, this looks like a bug. Thank you for reporting, @mattviguier and @mboll. @archmoj here's is the codepen. Let me know if we should transfer this to Plotly.js
When adding a shape to a legendgroup with showlegend=False, he does not toggle the visibility when clicking in the legend which is inconsistent with the expected behaviour of traces.
Here is the code to reproduce the graph.
Plotly version:
5.17.0
Full graph:
Trace legend group toggle:
Shape legend group toggle:
The text was updated successfully, but these errors were encountered: