Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DOC: remove constrained_layout kwarg from examples#25198

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jklymak merged 1 commit intomatplotlib:mainfromrcomer:examples-constrained-kwarg
Feb 13, 2023

Conversation

rcomer
Copy link
Member

PR Summary

The formconstrained_layout=True is discouraged in the relevantdocstrings since v3.5 (#19892), but is still used across the examples. This PR updates the examples with the preferred form. For the strings, I tried to choose single vs double quotes to be consistent with any strings on nearby lines. Also puts instances of the phrase "constrained layout" in italics, consistent with the decision for the constrained layout tutorial at#25144.

The tutorials and user guide also haveconstrained_layout=True in places, but I think that can be a separate PR.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

@rcomerrcomer added Documentation topic: geometry managerLayoutEngine, Constrained layout, Tight layout labelsFeb 11, 2023
import matplotlib.lines as ml
from matplotlib.ticker import Formatter

# Load a numpy record array from yahoo csv data with fields date, open, high,
# low, close, volume, adj_close from the mpl-data/sample_data directory. The
# record array stores the date as an np.datetime64 with a day unit ('D') in
# the date column (``r.date``).
r = (cbook.get_sample_data('goog.npz', np_load=True)['price_data']
.view(np.recarray))
r = cbook.get_sample_data('goog.npz', np_load=True)['price_data'].view(np.recarray)
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I know we said we wouldn't re-flow, but this line was crying out for it!

Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

One small nit. Could self merge if you take it or not so long as the doc build and flake8 pass.

r = r[:9] # get the first 9 days

fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(6, 6),
constrained_layout={'hspace':.15})
layout=ConstrainedLayoutEngine(hspace=0.15))
Copy link
Member

@jklymakjklymakFeb 11, 2023
edited
Loading

Choose a reason for hiding this comment

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

I don't mind this, but obscure imports are sometimes not nice. Maybe:

Suggested change
layout=ConstrainedLayoutEngine(hspace=0.15))
layout='constrained')
fig.get_layout_engine().set(hspace=0.15)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I don't feel strongly either way, so done.

Copy link
Member

@oscargusoscargus left a comment

Choose a reason for hiding this comment

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

As I am not updated on the 3.7 status, I am not merging, but looks good!

@jklymakjklymak modified the milestones:v3.8.0,v3.7.1Feb 11, 2023
@rcomerrcomerforce-pushed theexamples-constrained-kwarg branch 2 times, most recently from8b0a2ff to8278163CompareFebruary 12, 2023 13:49
@rcomerrcomerforce-pushed theexamples-constrained-kwarg branch from8278163 toe0dcac8CompareFebruary 12, 2023 13:50
@jklymakjklymak merged commit0b131ee intomatplotlib:mainFeb 13, 2023
@lumberbot-app
Copy link

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.7.xgit pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 0b131ee233f27c26db41d309d6c75984027cbd66
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #25198: DOC: remove constrained_layout kwarg from examples'
  1. Push to a named branch:
git push YOURFORK v3.7.x:auto-backport-of-pr-25198-on-v3.7.x
  1. Create a PR against branch v3.7.x, I would have named this PR:

"Backport PR#25198 on branch v3.7.x (DOC: remove constrained_layout kwarg from examples)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove theStill Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free tosuggest an improvement.

@rcomer
Copy link
MemberAuthor

I’ll take a look at the backport after 3.7.0 is out. Thanks for the reviews!

@rcomerrcomer self-assigned thisFeb 13, 2023
rcomer pushed a commit to rcomer/matplotlib that referenced this pull requestFeb 14, 2023
…rom examplesManual backport ofmatplotlib#25198 due to conflicts inexamples/subplots_axes_and_figures/demo_constrained_layout.pyThis was because some of the changes here were right below the sectionseparators which changed in main atmatplotlib#25021.
@rcomerrcomer removed their assignmentFeb 14, 2023
jklymak added a commit that referenced this pull requestFeb 14, 2023
Backport PR#25198 - DOC: remove constrained_layout kwarg from examples
@rcomerrcomer deleted the examples-constrained-kwarg branchMarch 4, 2023 16:33
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@oscargusoscargusoscargus approved these changes

Assignees
No one assigned
Labels
Documentationtopic: geometry managerLayoutEngine, Constrained layout, Tight layout
Projects
None yet
Milestone
v3.7.1
Development

Successfully merging this pull request may close these issues.

3 participants
@rcomer@jklymak@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp