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: Update Basic Usage tutorial#21800

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 4 commits intomatplotlib:mainfromStefRe:fix/usage
Dec 1, 2021
Merged

Conversation

StefRe
Copy link
Contributor

@StefReStefRe commentedNov 29, 2021
edited
Loading

PR Summary

1st commit: some minor fixes:

  • fix typos and PEP8 (line 338)
  • apply terminology and unify capitalization acc. to
    https://matplotlib.org/stable/devel/style_guide.html#terminology
  • insert missing # at line 133 to ensure correct sphinx formatting
  • replace -- by en dash (–), assmartquotes is set toFalse in conf.py
  • explicitly applyConciseDateFormatter so that it's clear why the date
    axis is formatted the way it is (examples\ticks\date_concise_formatter.py
    registers the ConciseDateConverter and when the documentation is being
    built, this example is processed before the tutorials and hence the
    registered converter is still in effect)
  • apply auto aspect to imshow axes for a visually more pleasing effect
  • remove redundant redefinition of x at line 248

@jklymak I hope you don't mind my rather intrusive terminology edits, just trying to follow the style guide. I'm not happy with adding the ConciseDateConverter but without doing so the tutorial seems a bit misleading or confusing if someone is trying to reproduce this example and gets a different result. It would be better to undo the converter registration but I couldn't think of a good way to do so.

2nd commit: add additional axes section

Secondary and twin axes are rather important (although not necessarily
very basic) so they should be shortly mentioned with links to the API
docs where more detailed examples are linked (unfortunately there's no
tutorial on secondary and twin axes to refer to).

@jklymak Maybe you can rephrase these two short sections into clearer language (sorry for my limited command of English when it comes to writing documentation)

PR Checklist

Tests and Styling
[n/a] Has pytest style unit tests (andpytest passes).

  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation
[n/a] New features are documented, with examples if plot related.
[n/a] New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
[n/a] API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
[n/a] Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@jklymak
Copy link
Member

Lets maybe get#21794 in first...

@StefRe
Copy link
ContributorAuthor

@jklymak oops, sorry - didn't see it when I started this one. Yes of course, will rebase then if necessary.

@jklymak
Copy link
Member

many of these edits are great, and thanks for catching the spelling errors!

We need to be careful about mission creep in this document. You've suggested adding multiple axises/secondary axis to the figure. One could also add more colorbar, inset axes, etc etc. Maybe instead of full examples, lets just have some text that links to relevant examples for twinx and secondary_ax?

@StefRe
Copy link
ContributorAuthor

StefRe commentedNov 29, 2021
edited
Loading

@jklymak

We need to be careful about mission creep in this document.

You're right, but IMHO a second y axis may be used more frequently than say math text or annotations (especially when you are used to Excel where you can send a data series with just one click to a second y axis on the right). I'd love to just refer to some tutorial on secondary, twin and shared and parasite axes (the latter two I left out intentionally), but there is none. So I tried to illustrate the concepts with two minimalistic examples as a short example is easier (at least for me) than describing the functionality in words.

Maybe we can combine the two paragraphs into one and show the examples side by side to make it even more concise (athough subplot are only introduced further down the tutorial, but the color mapped data section also uses subplots). But in the end I'm also happy with just the links to some examples.

@jklymak
Copy link
Member

Well, lets let others weigh in. My vote would be to trim rather than to add ;-)

There are quite a few twinx examples:https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.twinx.html and there is a seocndary_axis example:https://matplotlib.org/stable/gallery/subplots_axes_and_figures/secondary_axis.html#sphx-glr-gallery-subplots-axes-and-figures-secondary-axis-py

@StefRe
Copy link
ContributorAuthor

@jklymak sure, no problem.

Just in case: this is a less space-consuming version by putting the plots side by side:

grafik

jklymak reacted with thumbs up emoji

@tacaswell
Copy link
Member

I'm in favor of taking this extra section. I think twinned and secondary axes are on the same level of importance with annotations (but a bit behind math text) ;)

This is something that is particularly hard to describe to google so having a picture and link is 👍

@tacaswelltacaswell added this to thev3.6.0 milestoneNov 29, 2021
@story645
Copy link
Member

My vote would be to trim rather than to add ;-)

Is that a case for making an intermediate usage? Where basic is stripped down to how do I make one thing & label it, and intermediate is more of a grab bag of very commonly asked for things?

@jklymak
Copy link
Member

Please, no more grab bags!

But I'm warming to this section particular if it links out to the other examples. If the subject requires expansion or unification of those examples a new tutorial might make sense.

story645 reacted with thumbs up emoji

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.

Please rebase on#21794

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.

Thanks for the thorough review and edit. Mostly looks good to me, but lets work on the new section. Consider next time two separate PRs - one for new material and the other for edits....

@jklymakjklymak added Documentation Documentation: websitelayout/behavior/styling changes and removed Documentation labelsNov 30, 2021
@jklymakjklymak modified the milestones:v3.6.0,v3.5-docNov 30, 2021
@StefReStefReforce-pushed thefix/usage branch 2 times, most recently fromaf17fc6 to2a62854CompareNovember 30, 2021 10:56
@StefRe
Copy link
ContributorAuthor

StefRe commentedNov 30, 2021
edited
Loading

@jklymak Sorry for being a pain in the neck, but I also changedconstrained_layout=True tolayout='constrained'. This tutorial states "This tutorial covers ... and best practices ...", so I thought it shouldn't show discouraged usage:

constrained_layout : bool, default: :rc:`figure.constrained_layout.use`
This is equal to ``layout='constrained'``.
.. admonition:: Discouraged
The use of this parameter is discouraged. Please use
``layout='constrained'`` instead.

tacaswell reacted with thumbs up emoji

@jklymak
Copy link
Member

No, not a pain - I forgot about that change.

- fix typos and PEP8 (line 338)- apply terminology and unify capitalization acc. tohttps://matplotlib.org/stable/devel/style_guide.html#terminology- replace -- by en dash (–), as smartquotes is set to False in conf.py- explicitly apply ConciseDateFormatter so that it's clear why the date  axis is formatted the way it is(examples\ticks\date_concise_formatter.py  registers the ConciseDateConverter and when the documentation is being  built, this example is processed before the tutorials and hence the  registered converter is still in effect)- remove redundant redefinition of x at line 246 and move definition of  xdata at line 208 to where it is used
Secondary and twin axes are rather important (although not necessarilyvery basic) so they should be shortly mentioned with links to the APIdocs and some more detailed examples.
regarding implicit/explicit and pyplot/object oriented style
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.

Thanks a lot@StefRe! looks good to me...

@jklymakjklymak merged commit2e4189b intomatplotlib:mainDec 1, 2021
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestDec 1, 2021
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestDec 1, 2021
@StefReStefRe deleted the fix/usage branchDecember 1, 2021 15:22
timhoffm added a commit that referenced this pull requestDec 1, 2021
…800-on-v3.5.xBackport PR#21800 on branch v3.5.x (DOC: Update Basic Usage tutorial)
timhoffm added a commit that referenced this pull requestDec 1, 2021
…800-on-v3.5.0-docBackport PR#21800 on branch v3.5.0-doc (DOC: Update Basic Usage tutorial)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

Assignees
No one assigned
Labels
Documentation: websitelayout/behavior/styling changes
Projects
None yet
Milestone
v3.5-doc
Development

Successfully merging this pull request may close these issues.

4 participants
@StefRe@jklymak@tacaswell@story645

[8]ページ先頭

©2009-2025 Movatter.jp