plotly.py
plotly.py copied to clipboard
fig.add_vrect() items do not hide when clicking on grouped legend if showlegend=False
Hi,
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.
import plotly.graph_objects as go
fig = go.Figure()
fig.add_vrect(
x0=1.0, x1=3.0,
fillcolor="LightSalmon", opacity=0.3,
layer="below", line_width=0,
legendgrouptitle_text="Saturation",
legendgroup='saturation',
name='partial',
showlegend=True,
)
fig.add_vrect(
x0=3.5, x1=4.5,
fillcolor="LightSalmon", opacity=0.3,
layer="below", line_width=0,
legendgroup='saturation',
name='partial 2',
showlegend=False,
)
fig.show()