Skip to content

improve docstring of Axes.step - #10276

Merged
QuLogic merged 1 commit into
matplotlib:masterfrom
timhoffm:axes-doc-step
Feb 4, 2018
Merged

QuLogic merged 1 commit into
matplotlib:masterfrom
timhoffm:axes-doc-step

Conversation

@timhoffm

Copy link
Copy Markdown
Member

PR Summary

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

@tacaswell tacaswell left a comment

Copy link
Copy Markdown
Member

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.

Comment thread lib/matplotlib/axes/_axes.py Outdated
interscection point and extend the filled region up to this point.

step : {'pre', 'post', 'mid'}, optional
step : [ 'pre' | 'post' | 'mid' ], optional

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread lib/matplotlib/axes/_axes.py Outdated

Call signatures::

plot(x, y, [fmt], data=None, where='pre', **kwargs)

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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'}

@timhoffm timhoffm Jan 21, 2018 •

Copy link
Copy Markdown
Member Author

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

@QuLogic QuLogic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly good.

Comment thread 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)

Copy link
Copy Markdown
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?

Comment thread 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.

Copy link
Copy Markdown
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*.

Comment thread 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove "in the"

Comment thread 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove "in the".

Comment thread lib/matplotlib/axes/_axes.py Outdated
interscection point and extend the filled region up to this point.

step : {'pre', 'post', 'mid'}, optional
step : [ 'pre', 'post', 'mid' ], optional

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Undo also?

Comment thread 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.

Copy link
Copy Markdown
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