Skip to content

DOC: rename Usage Guide to Basic Usage and update #21641

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
Nov 27, 2021

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Nov 15, 2021

PR Summary

Renames Usage Guide tutorial to Basic Usage (tutorials/introductory/usage.py). This adds extensively to this guide to provide a short overview of how to use Matplotlib, with links to other tutorials or examples where appropriate or necessary. This is meant to be on par with the pyplot tutorial, but doesn't follow it slavishly.

History

This page used to have a bunch of explanatory material. A lot of this was moved in #21335 to /docs/users leaving this page quite thin. There is already the pyplot tutorial, and the "lifecycle of a plot" tutorial, but the pyplot tutorial is not the style we'd prefer people to use, and "lifecycle" goes deep in a couple of directions. (Actually, I'd like to remove that tutorial as well, or make it more "scientific" by not just making a bar plot of all things, but that is lower priority)

Goal

Not completeness, but enough ideas of what the library can do to point users to more complete resources.

Use default styles wherever possible. Only exception are the figure sizes, which are usually unsuitable for a website tutorial (in my opinion).

If there is a major part of the library for basic usage, feel free to comment.

Outline:

Basic usage

  • plot
  • anatomy
  • Note on coding styles
  • styling artists
    • colors
    • linestyles
    • markerstyles
  • labelling plots
    • xlabel, ylabel and title
    • axis: ticks and ticklabels (locators and formatters)
      • units: categorical and dates
    • text
    • annotations
    • legends
  • colormapping data
    • basic and colormaps
    • vmin, vmax
    • norms
    • colorbars
  • arranging axes
    • subplots
    • subplot_mosaic

[NOTE: depends on #21631 - I'll rebase when that is done. Only file to change is tutorials/introductory/usage.py]

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).

@jklymak jklymak added the Documentation: website layout/behavior/styling changes label Nov 15, 2021
@jklymak jklymak force-pushed the doc-basic-usage branch 3 times, most recently from 0b339f7 to 85de443 Compare November 15, 2021 15:15
@jklymak jklymak marked this pull request as draft November 15, 2021 15:18
@jklymak jklymak changed the title DOC: rename Usage Guide to Basic Usage... DOC: rename Usage Guide to Basic Usage and update Nov 16, 2021
@jklymak jklymak marked this pull request as ready for review November 16, 2021 12:56
@jklymak jklymak added this to the v3.5-doc milestone Nov 17, 2021
@jklymak
Copy link
Member Author

jklymak commented Nov 25, 2021

rebased on main...



def my_plotter(ax, data1, data2, param_dict):
"""
A helper function to make a graph
A helper function to make a graph.
Copy link
Member

Choose a reason for hiding this comment

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

I have mixed feeling about dropping the docstring. On one hand, I see the reason to make it terser, on the other hand we should model best practices.

Copy link
Member Author

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 about this, and am happy to add it back in. However, I think for a little in-script utility its OK to not have a numpydoc compliant docstring, and I found it distracting for a tutorial.

Comment on lines 294 to 297
ax.set_xlabel('Smarts')
ax.set_ylabel('Probability')
ax.set_title('Histogram of IQ')
ax.text(60, .025, r'$\mu=100,\ \sigma=15$')
Copy link
Member

@tacaswell tacaswell Nov 26, 2021

Choose a reason for hiding this comment

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

Suggested change
ax.set_xlabel('Smarts')
ax.set_ylabel('Probability')
ax.set_title('Histogram of IQ')
ax.text(60, .025, r'$\mu=100,\ \sigma=15$')
ax.set_xlabel('Value')
ax.set_ylabel('Probability')
ax.set_title('Histogram of normal distribution')
ax.text(60, .025, r'$\mu=100,\ \sigma=15$')

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to aardvark length (with a caveat that the distribution was not real, though I changed the mean to be correct for aardvarks).

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.

I think this a big improvement.

I left one additional comment changing the text in an example (IQ can be controversial and is non-material to the point we are trying to make so might as well avoid courting controversy), but won't block merging over that.

@jklymak can self-merge either taking the suggestion or not.

@jklymak
Copy link
Member Author

jklymak commented Nov 26, 2021

Yeah that one was left over from before so I didn't change it. But I wondered about it as well and am happy to switch to aardvark length or something.

We actually have a gender one somewhere which strikes me as even more potentially contentious - i will try and remember to open an issue for that

@tacaswell tacaswell merged commit edd5a70 into matplotlib:main Nov 27, 2021
@lumberbot-app
Copy link

lumberbot-app bot commented Nov 27, 2021

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.5.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -m1 edd5a70b0a9ef03f7146268e8e9f52ab32e83d0d
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #21641: DOC: rename Usage Guide to Basic Usage and update'
  1. Push to a named branch:
git push YOURFORK v3.5.x:auto-backport-of-pr-21641-on-v3.5.x
  1. Create a PR against branch v3.5.x, I would have named this PR:

"Backport PR #21641 on branch v3.5.x (DOC: rename Usage Guide to Basic Usage and update)"

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 the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@lumberbot-app
Copy link

lumberbot-app bot commented Nov 27, 2021

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.5.0-doc
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -m1 edd5a70b0a9ef03f7146268e8e9f52ab32e83d0d
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #21641: DOC: rename Usage Guide to Basic Usage and update'
  1. Push to a named branch:
git push YOURFORK v3.5.0-doc:auto-backport-of-pr-21641-on-v3.5.0-doc
  1. Create a PR against branch v3.5.0-doc, I would have named this PR:

"Backport PR #21641 on branch v3.5.0-doc (DOC: rename Usage Guide to Basic Usage and update)"

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 the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@jklymak jklymak deleted the doc-basic-usage branch November 27, 2021 07:44
jklymak pushed a commit to jklymak/matplotlib that referenced this pull request Nov 30, 2021
DOC: rename Usage Guide to Basic Usage and update
jklymak pushed a commit to jklymak/matplotlib that referenced this pull request Nov 30, 2021
jklymak added a commit that referenced this pull request Nov 30, 2021
jklymak added a commit that referenced this pull request Nov 30, 2021
…3.5.0-doc

Backport PR #21641: DOC: rename Usage Guide to Basic Usage and update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: website layout/behavior/styling changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants