Skip to content

Shared x-axis does not work when using grid layout #2705

Description

@CYHSM

It seems that sharing the x-axis breaks down when using a more complicated subplot layout. I noticed it in my plot and replicated it in the example from the documentation. I am using the newest version of plotly (4.9.0) but also noticed it in 4.8.1.

Standalone example:

fig = make_subplots(rows=2, cols=4, shared_xaxes=True,
                    specs=[[{"rowspan": 2, "colspan": 2}, None, {"colspan": 2}, None],[None, None, {"colspan": 2}, None]])

fig.add_trace(go.Scatter(x=[0, 1, 2], y=[10, 11, 12]),
              row=1, col=1)
fig.add_trace(go.Scatter(x=[2, 3, 4], y=[100, 110, 120]),
              row=1, col=3)
fig.add_trace(go.Scatter(x=[3, 4, 5], y=[1000, 1100, 1200]),
              row=2, col=3)
fig.update_layout(height=600, width=600,
                  title_text="Stacked Subplots with Shared X-Axes")
fig.show()

Expected behaviour: Shared x-axes across all subplots or across columns when using 'columns' instead of True.

Activity

  1. self-assigned this
    on Jun 18, 2024
  2. removed their assignment
    on Aug 2, 2024
  3. emilykl commented on Aug 31, 2026

    @emilykl
    Contributor

    I'm going to merge this one with #5427. There is a shared_xaxes parameter to make_subplots(), but it has some unexpected behavior, as described in more detail in #5427.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions