plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

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

Open joaopedroassad opened this issue 1 month ago • 1 comments

Description

Row and column titles are positioned using the subplot in the last column (row titles) or in the top row (column titles). When that cell is empty because another subplot spans into it, the title ends up on the wrong row/column and the last title is dropped. When the subplot in that cell spans several rows, its title is centred across the whole span.

Screenshots/Video

Image

Steps to reproduce

python
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])
# Actual:   [('Row A', 0.212)]  -> "Row A" sits next to row 2 and "Row B" is missing
# Expected: [('Row A', 0.787), ('Row B', 0.212)]

Notes

Two more layouts with the same problem:

  • specs=[[{}, {"rowspan": 2}], [{}, None]] with row_titles=["R1", "R2"]: R1 is centred across both rows (y=0.5) and R2 is missing.
  • specs=[[{"rowspan": 2}, {}], [None, {}]], start_cell="bottom-left" with column_titles=["C1", "C2"]: C1 is drawn over the second column and C2 is missing.

The docstring describes row_titles/column_titles as lists of length rows/cols with one title per row/column, so I'd expect each title to stay on its own row/column regardless of spans.

Reproduces on plotly 7.1.0 and on current main.

joaopedroassad avatar Oct 06 '26 03:10 joaopedroassad

Thanks for the report! Since you opened a PR, our team will review that and follow up.

camdecoster avatar Oct 06 '26 19:10 camdecoster