Skip to content

Fix create_plotting_grid behavior for single plots#428

Open
sanjiti-gill wants to merge 3 commits intoarviz-devs:mainfrom
sanjiti-gill:fix-single-plot-grid
Open

Fix create_plotting_grid behavior for single plots#428
sanjiti-gill wants to merge 3 commits intoarviz-devs:mainfrom
sanjiti-gill:fix-single-plot-grid

Conversation

@sanjiti-gill
Copy link
Contributor

Fixes inconsistent behavior of create_plotting_grid when generating a single plot.
When squeeze=True (default) and number=1, the plots structure can collapse into a scalar due to NumPy's squeeze behavior. This leads to inconsistent return types compared to multi-plot cases and can cause downstream issues when array-like behavior is expected.
This patch ensures that the single-plot case preserves a consistent 2D structure by wrapping 0D outputs back into a 1×1 array.

Context:
This relates to earlier discussion in #77 where maintainers suspected incorrect behavior for (1,1) grids. This PR localizes the fix to a minimal post-squeeze guard without altering existing API behavior.

Changes:
-Detect 0D output after squeeze
-Wrap into a 1×1 object array to preserve structure consistency

Closes #87

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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.

check create_plotting_grid beahviour for single plots

1 participant