-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
improve docstring of Axes.loglog, Axes.semilogx, Axes.semilogy #10278
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
lib/matplotlib/axes/_axes.py
Outdated
|
||
Parameters | ||
---------- | ||
basex, basey : scalar | ||
basex, basey : scalar, optional, default 10 |
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.
"must be >1" is actually not true (although this could arguably be discussed in a separate issue)
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.
Should I write something else? The semilogx/y
use the weaker phrase "The value should be larger than 1.".
I tested that I can generate plots with 0 < base < 1. No idea if there's a use-case for that. Negative values are accepted, but generate an error when drawing the plot (problably when updating the axes). Invalid values should be rejected by set_xscale
(or probably a level deeper, which I didn't follow through). Should I open an issue on that?
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 there isn't any real reason to reject 0<base<1, but given that base==1 won't work (of course), it may be simpler to indeed just spec base>1, or not say anything about it.
I think that's the job of the scale classes anyways.
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.
Ok, I'll remove it. It's not particularly helpful, to say something about the allowed values. People will know what base they want. And the scales should complain if they cannot handle it.
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.
Note: Removed. This is not reflected here, because it's on the next line.
e329e12
to
b8d84b4
Compare
b8d84b4
to
5b10ba8
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.
Some typos.
lib/matplotlib/axes/_axes.py
Outdated
|
||
nonposx, nonposy : ['mask' | 'clip' ] | ||
nonposx, nonposy : [ 'mask' | 'clip' ], optional, default 'mask' |
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.
Change to braces now?
lib/matplotlib/axes/_axes.py
Outdated
details. | ||
The location of the minor xticks. *None* defaults to autosubs, | ||
which depend on the number of decades in the plot. See | ||
`.Axes.set_xscale` for setails. |
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.
details
lib/matplotlib/axes/_axes.py
Outdated
nonposx : string, optional, {'mask', 'clip'} | ||
Non-positive values in x can be masked as | ||
invalid, or clipped to a very small positive number. | ||
nonposx : [ 'mask' | 'clip' ], optional, default 'mask' |
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.
Braces.
lib/matplotlib/axes/_axes.py
Outdated
details. | ||
The location of the minor yticks. *None* defaults to autosubs, | ||
which depend on the number of decades in the plot. See | ||
`.Axes.set_yscale` for setails. |
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.
details
lib/matplotlib/axes/_axes.py
Outdated
nonposy : string, optional, {'mask', 'clip'} | ||
Non-positive values in *y* can be masked as | ||
invalid, or clipped to a very small positive number. | ||
nonposy : [ 'mask' | 'clip' ], optional, default 'mask' |
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.
Braces.
5b10ba8
to
d39af52
Compare
Not sure it was the last commit you wanted to amend this time. |
@QuLogic Not really. But I just learned to amend a non-last commit. Anyway I don't think it's too bad as it is. Or do you want me to rewrite the commits? |
Just makes for an odd commit description, but it's up to you. |
d39af52
to
68683a1
Compare
1ed6f21
to
3a319b4
Compare
lib/matplotlib/axes/_axes.py
Outdated
see :meth:`matplotlib.axes.Axes.set_xscale` / | ||
:meth:`matplotlib.axes.Axes.set_yscale` for details. | ||
subsx, subsy : sequence, optional | ||
The location of the minor x/y ticks; *None* defaults to autosubs, |
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.
"autosubs" is actually never defined... (same for semilogx/y)
lib/matplotlib/scale.py
Outdated
@@ -253,6 +253,8 @@ def __init__(self, axis, **kwargs): | |||
|
|||
if nonpos not in ['mask', 'clip']: | |||
raise ValueError("nonposx, nonposy kwarg must be 'mask' or 'clip'") | |||
if base <= 0 or base == 1: | |||
raise ValueError('The log base cannot be <= 0 or == 1.') |
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.
no final dot in error messages
The -doc milestone is for rst related changes only. |
Backport PR #10278 on branch v2.2.x
PR Summary
As part of #10148: Docstring update for
Axes.loglog
,Axes.semilogx
andAxes.semilogy
.