Updating yaxis range using buttons in Plotly.py
Does anyone know a way to update the yaxis range on button click in Plotly.py? I am using buttons to toggle source data on a 2y axis plotly plot, and need to manually define the y axis ranges for each data series (due to the tick alignment issue that emerges in the default axis range when using 2y axis charts in Plotly).
For a single 2y chart (i.e., no buttons) I've employed the code below, which works fine. Curious if there is a way to update these fields on button click. I've tried flowing them into buttons.args, but I do not believe (based on external documentation) that these specific attributes are supported.
#Y-axis1 format fig.update_yaxes(title_text='First yaxis title', tickformat=y1_label_format, range=[y1_min,y1_max], tickvals=y1_tickvals, secondary_y=False) #Y-axis2 format fig.update_yaxes(title_text='Second yaxis Title', tickformat=y2_label_format, range=[y2_min,y2_max], tickvals=y2_tickvals, secondary_y=True)
I've also considered making multiple superimposed, independent charts with buttons to show only the selected chart (and hide the others), although I have not seen any reference on successfully hiding entire plots with buttons (rather than single traces / elements).
Any thoughts would be much appreciated...