✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Multiple dropdowns and subplots

Hello

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!

@arac_codespace
Welcome to Plotly forum! This notebook may suggest how to define your fig.layout.updatemenus and its buttons: https://chartstudio.plotly.com/~empet/15699

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

1 Like