Skip to content

improve Axes.stem docstring #10154

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 4 commits into from
Jan 19, 2018
Merged

improve Axes.stem docstring #10154

merged 4 commits into from
Jan 19, 2018

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Jan 4, 2018

PR Summary

As part of #10148 and part of the discussion in #10151: Docstring updates for Axes.stem and container.

@@ -2392,27 +2392,78 @@ def broken_barh(self, xranges, yrange, **kwargs):
@_preprocess_data(replace_all_args=True, label_namer=None)
def stem(self, *args, **kwargs):
"""
stem(*args, linefmt=None, markerfmt=None, basefmt=None, data=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, but of course that doesn't work with the doc generation in plt.plotting which tries to parse the first line of the docstring for a summary table (see build failure).

Long term plan should be to fix plt.plotting but in the meantime for this specific case you can hopefully get away with moving stuff into the actual signature...

@timhoffm
Copy link
Member Author

timhoffm commented Jan 4, 2018

For easier review:

Old docs:

New docs:

@anntzer
Copy link
Contributor

anntzer commented Jan 4, 2018

I would just mark the signature using py3 syntax, i.e.

stem([x,] y, *, linefmt, markerfmt, basefmt)

and not document kwargs except as a note at the bottom.

-------
a :class:`~matplotlib.container.StemContainer`

The stemcontainer may be treated like a tuple
Copy link
Contributor

Choose a reason for hiding this comment

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

should probably be indented under "a StemContainer"? rendered version looks wrong otherwise.

"""
Container for the artists of bar plots.

E.g. created in a :meth:`.Axes.bar` plot.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence no verb.

Something like

Container for the artists of bar plots (created by `~.Axes.bar`, etc.).

could fit as the first line of the docstring.

Same comment applies throughout PR.

@timhoffm
Copy link
Member Author

timhoffm commented Jan 4, 2018

@anntzer

stem([x,] y, *, linefmt, markerfmt, basefmt)

would imply that the *fmt are keyword-only. Quite the opposite is true. They can be optional positional or keyword args. There is no clear syntax for this. Maybe:

stem([x,] y, linefmt=None, markerfmt=None, basefmt=None)

or

stem([x,] y, [linefmt,] [markerfmt,] [basefmt])

?

@anntzer
Copy link
Contributor

anntzer commented Jan 4, 2018

Indeed. I think the first form you propose is good though?

@timhoffm
Copy link
Member Author

timhoffm commented Jan 4, 2018

Argeed, all changes pushed.

@jklymak jklymak merged commit e500d5b into matplotlib:master Jan 19, 2018
@QuLogic QuLogic added this to the v2.2 milestone Jan 19, 2018
@timhoffm timhoffm deleted the axes-stem branch January 20, 2018 12:23
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
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