✊🏿 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!

Updating a trace that doesn't have a dropdown, radio item, etc, but is associated with a dropdown, radio item, etc

I have a plot that has some interactivity built in, with several dropdowns and options within the dropdowns. However, let’s say I want to plot a trace that depends on a dropdown selection, but isn’t actually a dropdown option itself.

For example, lets say we can choose to look at a maximum temperature or daily precipitation forecast for Chicago, IL for the next 10 days. One dropdown would be ‘temperature’ and the other would be ‘precipitation’. We can make a simple line plot of the maximum temperature each day for the next 10 days. But what if we also want to look at the change in that forecast from yesterday? We could take today’s forecast and subtract it from yesterday’s to see the change for a specific day in the future. We could then plot this on a second axis as a bar plot.

The second axis (the 24-hour change) is not meant to be a dropdown option, but rather should be automatically plotted with whichever variable (max temperature or precipitation) is chosen. Is it possible to update the graph, i.e., precipitation is selected and the 24 hour change in forecasted precip is shown (or temperature is selected and the 24 hour change in the temperature forecast is shown)?