Hello,
I’m making figures using python 3.5, and having trouble with buttons.
In this case I am making a histogram with barmode = ‘overlay’, with multiple traces.
I want to be able to switch each trace on or off using buttons.
Following the examples on the tutorial page, I was able to use the following format:
updatemenus = list([
dict(type=“buttons”,
buttons =list([
dict(
label = ‘Age’,
method = ‘update’,
args = [{‘visible’ : [True,False,False]}]),
dict(
label = ‘Copper’,
method = ‘update’,
args = [{‘visible’ : [False,True,False]}]),
dict(
label = ‘Gold’,
method = ‘update’,
args = [{‘visible’ : [False,False,True]}]),
dict(
label = ‘All’,
method = ‘update’,
args = [{‘visible’ : [True,True,True]}])
])
)
])
This toggles visibility for the traces, but there are many more traces I want to plot, and this gets impractical. I would like to be able to have a single button for each trace, so that each could be toggled between “visible/hidden”, rather than have to make a custom button with boolean [True, False, True,…] for each possible permutation.
Is this possible?
Thanks for your help.
(Edit: To be clear, I want to be able to display a custom selection from a larger group of traces by toggling them on or off with a button. If I use the method above, I have to create a button for each possible combination of on\off states, which is impractical.)