The following python code will share the x-axis for all three subplots:
from plotly.subplots import make_subplotsimport plotly.graph_objects as gofig = make_subplots(rows=3, cols=1, shared_xaxes=True, vertical_spacing=0.02)fig.add_trace(go.Scatter(x=[0, 1, 2], y=[10, 11, 12]), row=3, col=1)fig.add_trace(go.Scatter(x=[2, 3, 4], y=[100, 110, 120]), row=2, col=1)fig.add_trace(go.Scatter(x=[3, 4, 5], y=[1000, 1100, 1200]), row=1, col=1)
Is there a simple way to share the x-axis on the first two rows, but allow the x-axis of the third row to be set freely?
I'm aware that it's possible to individually specify the ranges via calls to update_xaxis for the individual subplots. Was wondering if there was another approach that would avoid this: something in the spirit of what @Ali Taghipour Heidari suggested.