Repository navigation
Raise an error when a make_subplots span overlaps another subplot - #5858
Draft
LukeTheoJohnson wants to merge 2 commits into
Draft
LukeTheoJohnson wants to merge 2 commits into
LukeTheoJohnson wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue
Closes #5335
Description of change
make_subplotsnow raises aValueErrorwhen a cell covered by acolspanorrowspanalso holds a subplot inspecs. Before, the two subplots were drawn on top of each other. Thespecsdocstring already says to useNoneto move past a span.Demo
On
mainthe second subplot lands in column 2, inside the spanning one:With this change:
The layout from the issue is
specs=[[{"colspan": 2}, None, {}]], which already works and isn't changed.Testing strategy
Two tests in
test_make_subplots.py, one for an overlappingcolspanand one for an overlappingrowspan. Both fail onmain(nothing is raised) and pass with this change.tests/test_coreplustest_px,test_figure_factoryandtest_subplotsundertests/test_optionalgive the same results asmain.ruff checkandruff format --checkare clean.Additional information (optional)
Specs that overlap like this today will now raise instead of drawing. The covered cell's subplot always sits inside the span's cells, and
insetscovers the case where an overlap is wanted.Guidelines