-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[MRG+1] [DOC] Turn ginput dostring into a numpydocstring #8172
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/figure.py
Outdated
---------- | ||
n : int, optional | ||
Number of mouse clicks to accumulate. If negative, accumulate | ||
clicks until the input is terminated manually. |
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 "Default is 1."?
lib/matplotlib/figure.py
Outdated
(or potentially both mouse buttons at once) terminates the input. | ||
|
||
Right clicking cancels last input. | ||
Blocking call to interact with a figure. This will wait for *n* |
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 would rewrite the paragraph as
Wait until the user clicks n times on the figure. Returns the coordinates of each click in a list.
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.
Also, I believe (though it is very unsure) that we decided to drop the "*", which are a remainer of the past in Matplotlib's documentation.
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.
Not for arguments, see http://matplotlib.org/devdocs/devel/documenting_mpl.html#formatting.
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 this is a great improvement :)
lib/matplotlib/figure.py
Outdated
---------- | ||
n : int, optional | ||
Number of mouse clicks to accumulate. If negative, accumulate | ||
clicks until the input is terminated manually. Default is 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.
the numpydoc formats puts the default on the first line:
n : int, optional, default: 1
I find the numpydoc "offical" version more readable.
lib/matplotlib/figure.py
Outdated
(or potentially both mouse buttons at once) terminates the input. | ||
|
||
Right clicking cancels last input. | ||
Blocking call to interact with a figure. This will wait for *n* |
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.
Also, I believe (though it is very unsure) that we decided to drop the "*", which are a remainer of the past in Matplotlib's documentation.
lib/matplotlib/figure.py
Outdated
Returns | ||
------- | ||
points : list of tuples | ||
The clicked points. ``len(points)`` will equal the number of points |
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 would rewrite the entire thing (the three sentences) as A list of (x, y) coordinates of the clicks.
There is no "number of requested points" if n<0, and there can be fewer points if the user presses mouse_stop
prematurely.
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.
Yep, sounds better.
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.
LGTM modulo one item.
lib/matplotlib/figure.py
Outdated
(or potentially both mouse buttons at once) terminates the input. | ||
|
||
Right clicking cancels last input. | ||
Blocking call to interact with a figure. Wait until the user clicks *n* |
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 first line should be by itself with the remaining description on another paragraph (one blank line later).
lib/matplotlib/figure.py
Outdated
Number of seconds to wait before timing out. If zero or negative | ||
will never timeout. | ||
show_clicks : bool, optional, default: False | ||
If True, show a red cross at the location of each click |
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 final dots here and below (including returns), and squash? (otherwise that's a lot of commits :-))
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 addition to the comment above, I think the format should be, for example
show_clicks : bool, optional (default = False)
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 format seems much rarer in our codebase than the existing format.
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.
@QuLogic I will approve the PR after this (the dots -- squashing is up to you) is fixed.
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 format for defaults should probably added to the documenting matplotlib developer's guide. Note that numpy itself gives the example
Description of parameter `x` (the default is -1, which implies summation
over all axes).
(which is different and I dislike)
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 you meant to tag @dstansby there; I'm fine with this when you are.
lib/matplotlib/figure.py
Outdated
Number of seconds to wait before timing out. If zero or negative | ||
will never timeout. | ||
show_clicks : bool, optional, default: False | ||
If True, show a red cross at the location of each click |
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.
@QuLogic I will approve the PR after this (the dots -- squashing is up to you) is fixed.
Small fixes Add default value for npoints Suggested changes to ginput docstring Better description of ginput return Put summary line by itself at the top Add in missing full stops
8d53729
to
0151c05
Compare
I've added in the extra full stops, and given it a squash. |
Thanks @dstansby ! |
No description provided.