FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ENH: add width_ratios and height_ratios to subplots by jklymak · Pull Request #23191 · matplotlib/matplotlib · GitHub

Repository navigation

ENH: add width_ratios and height_ratios to subplots - #23191

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
jklymak:enh-add-wr-hr
Jun 28, 2022
Merged

QuLogic merged 1 commit into
matplotlib:mainfrom
jklymak:enh-add-wr-hr

Conversation

jklymak commented Jun 2, 2022 •
edited
Loading

Copy link
Copy Markdown
Member

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 marked this pull request as ready for review June 2, 2022 17:38
story645 marked this pull request as draft June 2, 2022 17:39

timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍 I support the idea.

Comment thread lib/matplotlib/figure.py Outdated
Comment thread lib/matplotlib/figure.py Outdated
jklymak force-pushed the enh-add-wr-hr branch 2 times, most recently from 04b6ea9 to f1a8cce Compare June 7, 2022 10:50
Comment thread lib/matplotlib/pyplot.py Outdated
jklymak marked this pull request as ready for review June 10, 2022 06:57
jklymak added API: consistency Consistency of the matplotlib API, including naming, behavior, defaults, … New feature labels Jun 10, 2022

jklymak commented Jun 10, 2022

Copy link
Copy Markdown
Member Author

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

Comment thread lib/matplotlib/figure.py Outdated
jklymak force-pushed the enh-add-wr-hr branch 3 times, most recently from 2e60682 to 17978e7 Compare June 13, 2022 11:27
Comment thread lib/matplotlib/tests/test_subplots.py Outdated
Comment thread lib/matplotlib/tests/test_subplots.py Outdated
QuLogic linked an issue Jun 21, 2022 that may be closed by this pull request

jklymak commented Jun 23, 2022

Copy link
Copy Markdown
Member Author

@story645 got time for a quick second look?

anntzer commented Jun 23, 2022 •
edited
Loading

Copy link
Copy Markdown
Contributor

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

Comment thread lib/matplotlib/figure.py Outdated
Comment thread lib/matplotlib/figure.py
Comment thread lib/matplotlib/pyplot.py Outdated
Comment thread lib/matplotlib/pyplot.py
tacaswell added this to the v3.6.0 milestone Jun 24, 2022
Comment thread lib/matplotlib/tests/test_subplots.py Outdated
Comment thread lib/matplotlib/pyplot.py Outdated

tacaswell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Anyone can merge on CI green.

jklymak commented Jun 25, 2022

Copy link
Copy Markdown
Member Author

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

QuLogic merged commit b02334b into matplotlib:main Jun 28, 2022
jklymak deleted the enh-add-wr-hr branch June 28, 2022 06:53
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

Labels

API: consistency Consistency of the matplotlib API, including naming, behavior, defaults, … New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

6 participants


Back | FazBrowse Home | New Git URL