Skip to content

Keep add_hline/add_vline on empty subplots when the target is explici… - #5873

Open
mutasim-rehman wants to merge 1 commit into
plotly:mainfrom
mutasim-rehman:cursor/hline-vline-empty-subplots-436f
Open

mutasim-rehman wants to merge 1 commit into
plotly:mainfrom
mutasim-rehman:cursor/hline-vline-empty-subplots-436f

Conversation

@mutasim-rehman

@mutasim-rehman mutasim-rehman commented Nov 6, 2026 •

Copy link
Copy Markdown

Fix line options being discarded on empty subplots when the intent is explicit.

Skip exclude_empty_subplots for add_hline/add_vline when the grid has a single subplot or both row and col are given. Default exclusion for unspecified cells in multi-subplot grids and hrect/vrect behavior are unchanged.

Link to issue

Closes #5136.

Description of change

Preserve axis-spanning lines added before traces when a figure has one subplot or the user explicitly selects a subplot with both row and col. The existing empty-subplot exclusion remains unchanged for unspecified or partially targeted multi-subplot grids, and add_hrect/add_vrect are unaffected.

Demo

No visual demo included. Regression tests verify the resulting line shapes and axis references; the four preservation cases fail before this change and pass afterward.

Testing strategy

Added regression tests covering single-subplot grids, explicitly selected cells, default exclusions, and unchanged rectangle behavior. The focused update-annotations and autoshapes tests pass: 59 passed.

Additional information (optional)

This implements the behavior suggested by the maintainer in #5136. Only the focused test files were run locally; full CI remains to validate the change.

Guidelines

plotly#5136)

Skip exclude_empty_subplots for add_hline/add_vline when the grid has a
single subplot or both row and col are given. Default exclusion for
unspecified cells in multi-subplot grids and hrect/vrect behavior are
unchanged.

Co-authored-by: Mutasim ur Rehman <motasimurrehman565@gmail.com>

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.

add_hline not working for make_subplots if not populated

2 participants