Home > Blockchain >  Unmark all labels when show plotly figure
Unmark all labels when show plotly figure

Time:01-06

I have this code:

df = pd.DataFrame(np.random.rand(5, 6))
fig = px.bar(df)
fig.show()

which show this output: enter image description here

I would like the starting output unmark all the variables (or to add a button that unmark them), so this will be the starting output: enter image description here

CodePudding user response:

Straight forward use of update_traces()

df = pd.DataFrame(np.random.rand(5, 6))
fig = px.bar(df).update_traces(visible="legendonly")
fig.show()
  •  Tags:  
  • Related