Skip to content

Fix row and column titles in make_subplots when edge cells are spanned - #5793

Open
joaopedroassad wants to merge 1 commit into
plotly:mainfrom
joaopedroassad:fix-subplot-titles-spans
Open

joaopedroassad wants to merge 1 commit into
plotly:mainfrom
joaopedroassad:fix-subplot-titles-spans

Conversation

@joaopedroassad

@joaopedroassad joaopedroassad commented Oct 6, 2026 •

Copy link
Copy Markdown

Link to issue

Closes #5792

Description of change

make_subplots now keeps every row and column title aligned with its own row/column when the edge cell it is anchored to is empty or covered by a subplot with rowspan/colspan. Before, that cell was skipped, which pushed the remaining titles onto the wrong rows/columns and dropped the last one.

Demo

from plotly.subplots import make_subplots

fig = make_subplots(
    rows=2,
    cols=2,
    specs=[[{"colspan": 2}, None], [{}, {}]],
    row_titles=["Row A", "Row B"],
)
print([(a.text, round(a.y, 3)) for a in fig.layout.annotations])

Before:

Screenshot 2026-10-05 at 22 54 10

[('Row A', 0.212)] (Row A next to row 2, Row B missing)

After:

Screenshot 2026-10-05 at 23 26 43

[('Row A', 0.787), ('Row B', 0.212)]

Testing strategy

Added test_row_and_column_titles_with_spanning_subplots, parametrized over three layouts (colspan covering the last cell of a row, rowspan in the last column, and a rowspan with start_cell="bottom-left" that leaves a top-row cell empty). It checks that the title positions match the same grid without spans. It fails on main and passes with this change. The existing subplot tests still pass, and regular grids (padding, uneven widths/heights, shared axes, secondary_y) produce exactly the same annotations as before.

Additional information (optional)

When the cell does hold a subplot that covers exactly that row/column, its own domain is still used, so l/r/t/b padding behaves as it did before. Only empty or spanned cells fall back to the grid cell geometry.

Guidelines

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: make_subplots drops or misplaces row_titles/column_titles when an edge cell is spanned

2 participants