Skip to content

[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

Merged
merged 1 commit into from
Mar 8, 2017

Conversation

dstansby
Copy link
Member

No description provided.

----------
n : int, optional
Number of mouse clicks to accumulate. If negative, accumulate
clicks until the input is terminated manually.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add "Default is 1."?

(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*
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

@NelleV NelleV left a 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 :)

----------
n : int, optional
Number of mouse clicks to accumulate. If negative, accumulate
clicks until the input is terminated manually. Default is 1.
Copy link
Member

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.

(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*
Copy link
Member

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.

Returns
-------
points : list of tuples
The clicked points. ``len(points)`` will equal the number of points
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, sounds better.

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.

LGTM modulo one item.

(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*
Copy link
Member

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

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

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

Copy link
Member

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)

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor

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)

Copy link
Member

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.

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

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.

@dstansby dstansby changed the title Turn ginput dostring into a numpydocstring [DOC] Turn ginput dostring into a numpydocstring Mar 7, 2017
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
@dstansby
Copy link
Member Author

dstansby commented Mar 7, 2017

I've added in the extra full stops, and given it a squash.

@anntzer anntzer changed the title [DOC] Turn ginput dostring into a numpydocstring [MRG+1] [DOC] Turn ginput dostring into a numpydocstring Mar 7, 2017
@NelleV NelleV merged commit 8277ddf into matplotlib:master Mar 8, 2017
@NelleV
Copy link
Member

NelleV commented Mar 8, 2017

Thanks @dstansby !

@dstansby dstansby deleted the ginput-docstring branch April 2, 2017 16:44
@QuLogic QuLogic added this to the v2.1 milestone Aug 12, 2021
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.

6 participants