Multiple dropdowns and subplots


I have some precipitation + groundwater depth data that I plotted into a figure as subplots (precipitation as a bar on top and groundwater as lineplot at bottom). Each data type has multiple timeseries from different sites, and I want to be able to choose between the different combinations of sites and look at their corresponding graph.

Is this (or a close enough alternative) somehow possible? I’ve been playing with the button visibility argument but I don’t think I’ll be able to do what I want using that option because this is statically setting the visibility of the traces.

Thanks in advance!

Welcome to Plotly forum! This notebook may suggest how to define your fig.layout.updatemenus and its buttons:

In your case after fig=make_subplots () definition,
the[k], k=0,1, …n, is the (k+1)th
trace added to fig, via fig.add_trace.

1 Like