-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Conversation
00ea6e8
to
1ea95c7
Compare
1ea95c7
to
93118f9
Compare
The failing test is something about latex. Since I've only changed docstring, it must be unrelated to the PR. |
Yes if you rebase it’ll pick up the latex fix. But this could pass w/o it. |
93118f9
to
ba8c366
Compare
rebased. |
lib/matplotlib/pyplot.py
Outdated
|
||
xticks( arange(12), calendar.month_name[1:13], rotation=17 ) | ||
**kwargs | ||
:class:`.Text` properties can be used to control the appearence of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appearance
lib/matplotlib/pyplot.py
Outdated
an empty list to disable ticks and labels. | ||
|
||
**kwargs | ||
:class:`.Text` properties can be used to control the appearence of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appearance
lib/matplotlib/pyplot.py
Outdated
|
||
>>> xticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue')) | ||
|
||
|
There was a problem hiding this comment.
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:
?
lib/matplotlib/pyplot.py
Outdated
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. |
There was a problem hiding this comment.
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
).
lib/matplotlib/pyplot.py
Outdated
|
||
# set the locations of the yticks | ||
yticks( arange(6) ) | ||
|
There was a problem hiding this comment.
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:
?
ba8c366
to
571785e
Compare
There was a problem hiding this 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.
lib/matplotlib/pyplot.py
Outdated
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*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the the -> at the
lib/matplotlib/pyplot.py
Outdated
empty list to disable yticks. | ||
|
||
labels : array_like, optional | ||
A list of explicit labels to place the the given *locs*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the the -> at the
You should also updated the corresponding `z` functions in mplot3d so that
they match up.
…On Mon, Feb 12, 2018 at 2:24 AM, Elliott Sales de Andrade < ***@***.***> wrote:
***@***.**** commented on this pull request.
A couple minor typos.
------------------------------
In lib/matplotlib/pyplot.py
<#10296 (comment)>
:
>
- 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*.
the the -> at the
------------------------------
In lib/matplotlib/pyplot.py
<#10296 (comment)>
:
> + Get or set the current tick locations and labels of the y-axis.
+
+ Call signatures::
+
+ locs, labels = yticks() # Get locations and labels
+
+ yticks(locs, [labels], **kwargs) # Set locations and labels
+
+ Parameters
+ ----------
+ locs : array_like
+ A list of positions at which ticks should be placed. You can pass an
+ empty list to disable yticks.
+
+ labels : array_like, optional
+ A list of explicit labels to place the the given *locs*.
the the -> at the
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10296 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-I7RRDWe_xchKxRlMPkayfWpcvU6ks5tT-cXgaJpZM4Ro5iC>
.
|
571785e
to
477a055
Compare
@WeatherGod updating the |
There was a problem hiding this 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.
lib/matplotlib/pyplot.py
Outdated
|
||
: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. |
There was a problem hiding this comment.
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_xlabel
on the current axes.
lib/matplotlib/pyplot.py
Outdated
|
||
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 |
There was a problem hiding this comment.
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
lib/matplotlib/pyplot.py
Outdated
|
||
Notes | ||
----- | ||
This is just a shortcut for calling `~.Axes.get_xlim` or `~.Axes.set_xlim` |
There was a problem hiding this comment.
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.
477a055
to
d4b968b
Compare
d4b968b
to
c05da63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pending CI
c05da63
to
5e0d81e
Compare
5e0d81e
to
6f28a57
Compare
The mac failure is due to homebrew changing how python3 installs |
Backport PR #10296 on branch v2.2.x
PR Summary
This PR improves th docstrings of pyplot axis-related functions:
x/yscale
x/ylim
x/ylabel
x/yticks