-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
improve docstring of Axes.step #10276
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
542a427
to
3c93379
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.
two minor comments, not going to block merging over either.
lib/matplotlib/axes/_axes.py
Outdated
@@ -4992,16 +5018,18 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False, | |||
Setting *interpolate* to *True* will calculate the actual | |||
interscection point and extend the filled region up to this point. | |||
|
|||
step : {'pre', 'post', 'mid'}, optional | |||
step : [ 'pre' | 'post' | 'mid' ], optional |
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 way this was is the numpydoc specified way of listing enumerated values, I think we should be moving to that style and away from the [ | ]
style (unless I have missed something.
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 this consensus? The documentation guide is still using [ | ]
in its examples.
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'd say it should be updated then.
lib/matplotlib/axes/_axes.py
Outdated
@@ -1931,37 +1931,63 @@ def step(self, x, y, *args, **kwargs): | |||
""" | |||
Make a step plot. | |||
|
|||
Call signatures:: | |||
|
|||
plot(x, y, [fmt], data=None, where='pre', **kwargs) |
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.
data
should probably go after kwargs as it is a keyword-only argument.
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.
But that might look odd, since the **kwargs form has to be at the end when one actually calls a function. I would put data
after where
, since data
is more generic, but I wouldn't put it after **kwargs
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.
In 3.6 you can put keywords after kwargs :)
In [5]: def foo(**kwargs): print(kwargs)
In [6]: foo(**{'a': 'a', 'b': 'b'}, c='c')
{'a': 'a', 'b': 'b', 'c': 'c'}
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.
That'd be a bit awkward. AFAIK, explicit arguments are not allowed after **kwargs
in a signature (try def f(**kw, a=None)
). I can switch to the Python 3 syntax plot(x, y, [fmt], *, data=None, where='pre', **kwargs)
.
3c93379
to
abdf672
Compare
abdf672
to
311ae7f
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.
Mostly good.
lib/matplotlib/axes/_axes.py
Outdated
Call signatures:: | ||
|
||
plot(x, y, [fmt], *, data=None, where='pre', **kwargs) | ||
plot(x, y, [fmt], x2, y2, [fmt2], ..., *, where='pre', **kwargs) |
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.
These should be step
, no?
lib/matplotlib/axes/_axes.py
Outdated
|
||
data : indexable object, optional | ||
An object with labelled data. If given, provide the label names to | ||
plot in x and y. |
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.
in *x* and *y*.
lib/matplotlib/axes/_axes.py
Outdated
- 'post': The y value is continued constantly to the right from | ||
every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the | ||
value ``y[i]``. | ||
- 'mid': Steps occur in the half-way between the *x* positions. |
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.
Remove "in the"
lib/matplotlib/axes/_axes.py
Outdated
- 'mid': Steps occur in the middle between the *x* positions. | ||
every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the | ||
value ``y[i]``. | ||
- 'mid': Steps occur in the half-way between the *x* positions. |
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.
Remove "in the".
lib/matplotlib/axes/_axes.py
Outdated
@@ -5173,16 +5201,18 @@ def fill_betweenx(self, y, x1, x2=0, where=None, | |||
Setting *interpolate* to *True* will calculate the actual | |||
interscection point and extend the filled region up to this point. | |||
|
|||
step : {'pre', 'post', 'mid'}, optional | |||
step : [ 'pre', 'post', 'mid' ], optional |
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.
Undo also?
lib/matplotlib/axes/_axes.py
Outdated
- 'post': The y value is continued constantly to the right from | ||
every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the | ||
value ``y[i]``. | ||
- 'mid': Steps occur in the half-way between the *x* positions. |
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.
Remove "in the".
311ae7f
to
b3fa851
Compare
PR Summary
As part of #10148: Docstring update for
Axes.step
.