hi all,
I set up multiple subplots using add_traces with each a candlestick trace. However, the update_layout for xaxis_rangeslider_visible seems to be working for the first subplot only. any idea? much appreciated.
When you update the layout, the argument xaxis refers only to the first subplot x-axis. To refer to the other subplots you have to point to the respective axes for each subplot with something like xaxis2_rangeslider_visible=False, xaxis3_rangeslider_visible=False, etc.
Only posting because I searched for this forever and couldnβt find anything, but here is the more elegant solution:
Use fig.for_each_xaxis(fn) to iterate through all xaxis of subplots (alternative use for_each_trace if you donβt want to set all rangesliders to not visible)
Where fn takes a single plotly.graph_objects.layout.XAxisas argument
Any subsequent calls for with fig.update_layout(xaxis_rangeslider_visible=False) will have no effect.
To remove the rangeslider for each subsequent trace, you have to refer to them by their row and col.