8000 ENH: add width_ratios and height_ratios to subplots by jklymak · Pull Request #23191 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

ENH: add width_ratios and height_ratios to subplots #23191

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2022

Conversation

jklymak
Copy link
Member
@jklymak jklymak commented Jun 2, 2022

PR Summary

I'm guessing 99.9% of the use of gridspec_kws is to set the height or width ratios of axes. And it is pretty esoteric to ask people to know about gridspecs in order to access this. Here we add width_ratios and height_ratios to the subplots and subplot_mosaic calls.

Previously we would do

fig, axs = plt.subplots(1, 2, gridspec_kw={'width_ratios': [1, 2]})

This PR allows

fig, axs = plt.subplots(1, 2, width_ratios=[1, 2])

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@story645 story645 marked this pull request as ready for review June 2, 2022 17:38
@story645 story645 marked this pull request as draft June 2, 2022 17:39
Copy link
Member
@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

👍 I support the idea.

@jklymak jklymak force-pushed the enh-add-wr-hr branch 2 times, most recently from 04b6ea9 to f1a8cce Compare June 7, 2022 10:50
@jklymak jklymak marked this pull request as ready for review June 10, 2022 06:57
@jklymak
Copy link
Member Author
jklymak commented Jun 10, 2022

This is ready to go, and I'll argue its a pretty big quality of life enhancement for anyone making different-width/height plots.

@jklymak jklymak force-pushed the enh-add-wr-hr branch 3 times, most recently from 2e60682 to 17978e7 Compare June 13, 2022 11:27
@QuLogic QuLogic linked an issue Jun 21, 2022 that may be closed by this pull request
@jklymak
Copy link
Member Author
jklymak commented Jun 23, 2022

@story645 got time for a quick second look?

@anntzer
Copy link
Contributor
anntzer commented Jun 23, 2022

Sorry for being late to the party, but see also #21942 (comment).
Edit: @jklymak made a strong reply at #21942 (comment).

@tacaswell tacaswell added this to the v3.6.0 milestone 8000 Jun 24, 2022
Copy link
Member
@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

Anyone can merge on CI green.

@jklymak
Copy link
Member Author
jklymak commented Jun 25, 2022

Squashed and rebased on master so font fix should be in there...

@QuLogic QuLogic merged commit b02334b into matplotlib:main Jun 28, 2022
@jklymak jklymak deleted the enh-add-wr-hr branch June 28, 2022 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH]: add width/height_ratios to subplots and friends
6 participants
0