Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve docstrings of pyplot axis-related functions #10296

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 4 commits into from
Mar 16, 2018

Conversation

timhoffm
Copy link
Member

PR Summary

This PR improves th docstrings of pyplot axis-related functions:

  • x/yscale
  • x/ylim
  • x/ylabel
  • x/yticks

@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from 00ea6e8 to 1ea95c7 Compare January 24, 2018 01:54
@timhoffm timhoffm added this to the v2.2 milestone Jan 24, 2018
@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from 1ea95c7 to 93118f9 Compare January 29, 2018 23:07
@timhoffm
Copy link
Member Author

timhoffm commented Feb 1, 2018

The failing test is something about latex. Since I've only changed docstring, it must be unrelated to the PR.

@timhoffm timhoffm requested a review from dstansby February 1, 2018 21:00
@jklymak
Copy link
Member

jklymak commented Feb 1, 2018

Yes if you rebase it’ll pick up the latex fix. But this could pass w/o it.

@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from 93118f9 to ba8c366 Compare February 1, 2018 21:33
@timhoffm
Copy link
Member Author

timhoffm commented Feb 1, 2018

rebased.


xticks( arange(12), calendar.month_name[1:13], rotation=17 )
**kwargs
:class:`.Text` properties can be used to control the appearence of
Copy link
Member

Choose a reason for hiding this comment

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

appearance

an empty list to disable ticks and labels.

**kwargs
:class:`.Text` properties can be used to control the appearence of
Copy link
Member

Choose a reason for hiding this comment

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

appearance


>>> xticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue'))


Copy link
Member

Choose a reason for hiding this comment

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

Add heading Set text labels and properties:?

properties. For example, to rotate long labels::
labels : array_like, optional
A list of explicit labels to place at the given *locs*. You can pass
an empty list to disable ticks and labels.
Copy link
Member

Choose a reason for hiding this comment

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

Is the empty list for labels or locs? The example below passes it as the first parameter (locs).


# set the locations of the yticks
yticks( arange(6) )

Copy link
Member

Choose a reason for hiding this comment

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

Add heading Set text labels and properties:?

@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from ba8c366 to 571785e Compare February 4, 2018 23:20
Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

A couple minor typos.

The keyword args, if any, are :class:`~matplotlib.text.Text`
properties. For example, to rotate long labels::
labels : array_like, optional
A list of explicit labels to place the the given *locs*.
Copy link
Member

Choose a reason for hiding this comment

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

the the -> at the

empty list to disable yticks.

labels : array_like, optional
A list of explicit labels to place the the given *locs*.
Copy link
Member

Choose a reason for hiding this comment

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

the the -> at the

@WeatherGod
Copy link
Member

WeatherGod commented Feb 12, 2018 via email

@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from 571785e to 477a055 Compare February 13, 2018 00:13
@timhoffm
Copy link
Member Author

@WeatherGod updating the z functions is not trivial for a bunch of reasons, because the have some differences. I would rather tackle these in a separate pull request.

Copy link
Member

@story645 story645 left a comment

Choose a reason for hiding this comment

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

I love more clear reviews, I just think the docs should clearly distinguish these are the methods for the pyplot interface and these are their pyplot equivalents.


:func:`~matplotlib.pyplot.text`
For information on how override and the optional args work
This is just a shortcut for calling `.set_xlabel` on the current axes.
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this implies that either ax.xlabel or plt.set_xlabel valid.
Alternative suggestion is something like: this is the pyplot interface equivalent of calling :method:~matplotlib.axes.Axes.set_xlabelon the current axes.


If you do not specify args, you can pass the xmin and xmax as
kwargs, e.g.::
If you do not specify args, you can alternatively pass *xmin* or *xmax* as
Copy link
Member

Choose a reason for hiding this comment

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

I think the alternatively is clearly implied here


Notes
-----
This is just a shortcut for calling `~.Axes.get_xlim` or `~.Axes.set_xlim`
Copy link
Member

Choose a reason for hiding this comment

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

Same as set_xlabel/set_ylable comment. Calling this function with no arguments (e.g. xlim()) is the pyplot equivalent of calling ~.Axes.get_xlim on the current axis. Calling this function with arguments (e.g. xlim(xmin=3, xmax=5) is the pyplot equivalent of calling ~.Axes.set_xlim on the current axis.

@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from 477a055 to d4b968b Compare February 13, 2018 22:52
@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from d4b968b to c05da63 Compare February 24, 2018 20:05
Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

pending CI

@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from c05da63 to 5e0d81e Compare February 25, 2018 17:47
@timhoffm timhoffm force-pushed the pyplot-doc-xysettings branch from 5e0d81e to 6f28a57 Compare March 3, 2018 11:54
@timhoffm timhoffm modified the milestones: needs sorting, v2.2-doc Mar 6, 2018
@tacaswell tacaswell modified the milestones: v2.2-doc, v2.2.1 Mar 16, 2018
@tacaswell tacaswell merged commit cc7d086 into matplotlib:master Mar 16, 2018
@tacaswell
Copy link
Member

The mac failure is due to homebrew changing how python3 installs

timhoffm added a commit that referenced this pull request Mar 16, 2018
@timhoffm timhoffm deleted the pyplot-doc-xysettings branch March 18, 2018 00:10
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.

7 participants