Skip to content

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

Merged
merged 1 commit into from
Feb 4, 2018
Merged

Conversation

timhoffm
Copy link
Member

PR Summary

As part of #10148: Docstring update for Axes.step.

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.

two minor comments, not going to block merging over either.

@@ -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
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

@@ -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)
Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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'}

Copy link
Member Author

@timhoffm timhoffm Jan 21, 2018

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

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.

Mostly good.

Call signatures::

plot(x, y, [fmt], *, data=None, where='pre', **kwargs)
plot(x, y, [fmt], x2, y2, [fmt2], ..., *, where='pre', **kwargs)
Copy link
Member

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?


data : indexable object, optional
An object with labelled data. If given, provide the label names to
plot in x and y.
Copy link
Member

Choose a reason for hiding this comment

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

in *x* and *y*.

- '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.
Copy link
Member

Choose a reason for hiding this comment

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

Remove "in the"

- '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.
Copy link
Member

Choose a reason for hiding this comment

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

Remove "in the".

@@ -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
Copy link
Member

Choose a reason for hiding this comment

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

Undo also?

- '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.
Copy link
Member

Choose a reason for hiding this comment

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

Remove "in the".

@QuLogic QuLogic merged commit 5e6ce5c into matplotlib:master Feb 4, 2018
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
@timhoffm timhoffm deleted the axes-doc-step branch December 17, 2018 20:39
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.

5 participants