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
{{ message }}
Repository navigation
fig.add_vrect() items do not hide when clicking on grouped legend if showlegend=False #4705
Here's a reproducible example below. Clicking on the legend group does not hide the second vrect (unlike for fig.add_trace(go.Scatter()) calls). I tried it on versions 5.23.0 and 5.19.0.
I got the same problem with Shapes and legendgroup. Only when all legends are set to visible they can be toggled together, otherwise only the one with showlegend=True. I'm using Pyhton 3.10.0 and Plotly 5.23.0. Here's a reproducible example:
I added traces to confirm the intended behavior. I would think legendgroups for traces and shapes should work in the same way, great if they could even work while grouped together.
Hi @pcubillos, apologies for the very late follow-up. This was fixed by plotly/plotly.js#7813 and first released in plotly.py v6.8.0. Shapes with showlegend=False are now hidden/shown when hiding/showing all shapes, the same as for traces.
Activity
lucas-schroeder commentedon Aug 27, 2024
I got the same problem with Shapes and
legendgroup. Only when all legends are set to visible they can be toggled together, otherwise only the one with showlegend=True. I'm using Pyhton 3.10.0 and Plotly 5.23.0. Here's a reproducible example:ritsuki1227 commentedon Feb 11, 2025
I’m experiencing the same issue on plotly 6.0.0.
mhangaard commentedon Jan 13, 2026
I have the same issue with version 6.5.0
In a notebook:
I added traces to confirm the intended behavior. I would think legendgroups for traces and shapes should work in the same way, great if they could even work while grouped together.
emilykl commentedon Sep 2, 2026
Hi @pcubillos, apologies for the very late follow-up. This was fixed by plotly/plotly.js#7813 and first released in plotly.py v6.8.0. Shapes with
showlegend=Falseare now hidden/shown when hiding/showing all shapes, the same as for traces.