Shared x-axis on different figures

Is it possible to share the x-axis between different figures?
In particular I would be interested in doing so in a non-Dash application, so only client-side code.

Hey @edobez ,

You are looking for the shared_xaxes=True attribute of plotly.subplots.make_subplots(), if I understood your question correctly.

You can learn more about subplots from this documentation.

Here is a minimal usage example of shared_xaxes attribute:

from plotly.subplots import make_subplots
import plotly.graph_objects as go

fig = make_subplots(rows=3, cols=1, shared_xaxes=True)

    x=[3, 4, 5],
    y=[1000, 1100, 1200],
), row=1, col=1)

    x=[2, 3, 4],
    y=[100, 110, 120],
), row=2, col=1)

    x=[0, 1, 2],
    y=[10, 11, 12],
), row=3, col=1)

fig.update_layout(height=600, width=600, title_text="Stacked Subplots")


1 Like