✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Color = <col name> . On the plot how to select rather de-select?

Hello -

we use ‘color’ to group the data. On the plot, on the right hand side labels come. And we un select . If we have many values it is difficult to get one. How to select it rather deselect?

Would the option visible='legendonly'solve your problem ?

import plotly.graph_objects as go
animals=['giraffes', 'orangutans', 'monkeys']

fig = go.Figure(data=[
    go.Bar(name='SF Zoo', x=animals, y=[20, 14, 23]),
    go.Bar(name='LA Zoo', x=animals, y=[12, 18, 29], visible='legendonly'),
    go.Bar(name='Paris Zoo', x=animals, y=[7, 11, 5])
])
# Change the bar mode
fig.update_layout(barmode='group')
fig.show()

Legends should be available for all but there should be option to select it than deselect.