Skip to content

DOC: clarify GridSpec ratio updates - #32415

Open
QianyeSu wants to merge 1 commit into
matplotlib:mainfrom
QianyeSu:docs/clarify-gridspec-ratio-updates
Open

QianyeSu wants to merge 1 commit into
matplotlib:mainfrom
QianyeSu:docs/clarify-gridspec-ratio-updates

Conversation

@QianyeSu

@QianyeSu QianyeSu commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

PR summary

GridSpec.set_width_ratios and set_height_ratios update the ratios stored by a GridSpec, but existing Axes are not repositioned unless a layout engine runs or their SubplotSpec is re-evaluated. This behavior is currently implicit and can be surprising when a setter is called after Axes have been created.

This change documents that existing-Axes behavior in both setter docstrings and points users to the supported ways to apply the updated ratios.

Closes #31971

AI Disclosure

I used generative AI to help inspect the repository, identify the relevant issue, and proofread this description. I reviewed and verified the change and the test result myself.

PR quality check

  • Use an expressive title
  • New and changed code is tested (documentation-only change; existing GridSpec tests pass)
  • Plotting related features are demonstrated in an example (not applicable)
  • New features and API changes have release notes (not applicable; documentation clarification only)
  • Documentation complies with the contribution guidelines

Testing

  • ./.venv/bin/pytest -q lib/matplotlib/tests/test_gridspec.py (7 passed)
  • git diff --check

Copilot AI balanced review requested due to automatic review settings October 1, 2026 11:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the topic: geometry manager LayoutEngine, Constrained layout, Tight layout label Oct 1, 2026

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

topic: geometry manager LayoutEngine, Constrained layout, Tight layout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Changing GridSpec column/row ratios after axes creation does not update the figure layout

2 participants