Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix add hline not working for make_subplot if not populated#5254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Erikp15 wants to merge7 commits intoplotly:main
base:main
Choose a base branch
Loading
fromErikp15:fix-add_hline-not-working

Conversation

Erikp15
Copy link

@Erikp15Erikp15 commentedJun 27, 2025
edited
Loading

This is a proposal fix for issue#5136
I first reproduced the issue and created two unit tests,test_add_hline_empty_subplots.py andtest_hline_subplots_bug.py, that check if the bug is resolved. Then I implemented the fix (outlined below), which passed both of the new unit tests, and in the process, no old tests were broken.

Root cause

add_shape() is called withexclude_empty_subplots=True. For a freshmake_subplots figure, every subplot is flagged empty, so the h/v line shape is filtered out and never appears, even after traces are later added.

Fix overview

Whenadd_hline/add_vline are invoked and the figure contains no traces (len(self.data)==0), the code now disables the exclude empty subplots logic before delegating toadd_shape, allowing the shape to be created and later displayed once data is added.

Code PR

  • I have read through thecontributing notes and understand the structure of the package. In particular, if my PR modifies code ofplotly.graph_objects, my modifications concern the code generator andnot the generated files.
  • I have added tests or modified existing tests.
  • For a new feature, I have added documentation examples (please see the doc checklist as well).
  • I have added a CHANGELOG entry if changing anything substantial.
  • For a new feature or a change in behavior, I have updated the relevant docstrings in the code.

@gvwilsongvwilson self-assigned thisJul 3, 2025
@gvwilsongvwilson added P1needed for current cycle communitycommunity contribution fixfixes something broken labelsJul 3, 2025
@Erikp15
Copy link
Author

Hi@gvwilson , just checking in to see if there's anything else needed from my end on this PR. Happy to make any changes if needed.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees

@gvwilsongvwilson

Labels
communitycommunity contributionfixfixes something brokenP1needed for current cycle
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Erikp15@gvwilson

[8]ページ先頭

©2009-2025 Movatter.jp