8000 improve docstrings for Axes.bar, Axes.barh, Axes.stackplot by timhoffm · Pull Request #10182 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

improve docstrings for Axes.bar, Axes.barh, Axes.stackplot #10182

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
Jan 9, 2018

Conversation

timhoffm
Copy link
Member
@timhoffm timhoffm commented Jan 6, 2018

PR Summary

As part of #10148: Docstring updates for Axes.bar, Axes.barh and Axes.stackplot.

@timhoffm
Copy link
Member Author
timhoffm commented Jan 6, 2018

For easier review:

Old docs:

New docs:

(left, right, bottom and top edges) by default. *x*,
*height*, *width*, and *bottom* can be either scalars or
sequences.
(left, right, bottom and top edges) by default. *x*, *height*,
Copy link
Contributor

Choose a reason for hiding this comment

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

would also remove the math markup just before, whose html rendering is a bit unwieldy, and replace it by e.g. inline double-backquotes.

Copy link
Member Author

Choose a reason for hiding this comment

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

The sentence is a bit technical anyway. Nobody thinks of a bar plot in terms of rectangle coordinates. Will switch to a more semantic description.

8000

Copy link
Member Author

Choose a reason for hiding this comment

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

changed.

``'weighted_wiggle'`` does the same but weights to account for size of
each layer. It is also called 'Streamgraph'-layout. More details
can be found at http://leebyron.com/streamgraph/.
baseline : ['zero' | 'sym' | 'wiggle' | 'weighted_wiggle']
Copy link
Contributor

Choose a reason for hiding this comment

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

in the doc for y (just above): OR -> or (lowercase)

Copy link
Member Author

Choose a reason for hiding this comment

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

changed.

``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.

error_kw : dict, optional
dictionary of kwargs to be passed to errorbar method. *ecolor* and
*capsize* may be specified here rather than as independent kwargs.
Dictionary of kwargs to be passed to the `~.Axes.errorbar()`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we tend not to include parentheses explicitly (and it would be better to rely on http://www.sphinx-doc.org/en/1.6.5/config.html#confval-add_function_parentheses to set the default doc-wide anyways). Same comment applies throughout.

Copy link
Member Author
@timhoffm timhoffm Jan 6, 2018

Choose a reason for hiding this comment

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

I don't agree with this. Explicitly indicating that fill_between is a function has a value. This should be visible also in plain textual docs, e.g. when viewing it in the terminal.

I propose to discuss the strategy here and document whatever the result is in https://github.com/matplotlib/matplotlib/blob/master/doc/devel/documenting_mpl.rst Should I open an issue on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't mind discussing the change (well I don't like it but that's another point), but for now grepping for

\(\)`

and manually exluding the cases where it is followed by a second backquote (i.e., actual code samples) in lib/ yields less than 10 cases, whereas I'm pretty certain there's many more cases without parentheses. So unless we agree to switch styles, I'd stick to the version without parentheses.

r : list
A list of `PolyCollection`, one for each element in the stacked area
plot.
list of `~matplotlib.collections.PolyCollection`
Copy link
Contributor

Choose a reason for hiding this comment

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

The unqualified name (~.PolyCollection) is enough to resolve the class. Same below.

@tacaswell tacaswell added this to the v2.2 milestone Jan 6, 2018
@timhoffm timhoffm force-pushed the axes-doc-minor-changes branch from f3ca536 to 3b2b44e Compare January 6, 2018 23:20
@@ -1877,102 +1877,88 @@ def bar(self, *args, **kwargs):
bar(x, height, width, *, align='center', **kwargs)
bar(x, height, width, bottom, *, align='center', **kwargs)

Make a bar plot with rectangles bounded by
The bars are positioned at *x* with the given *align*ment. Their
Copy link
Contributor

Choose a reason for hiding this comment

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

*align*\ ment

(per http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#escaping-mechanism

In non-URI contexts, backslash-escaped whitespace characters are removed from the document. This allows for character-level inline markup.)

@timhoffm timhoffm force-pushed the axes-doc-minor-changes branch from 3b2b44e to 40a0dd0 Compare January 6, 2018 23:39
@jklymak jklymak merged commit 0bcc13f into matplotlib:master Jan 9, 2018
@timhoffm timhoffm deleted the axes-doc-minor-changes branch January 9, 2018 00:39
@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
0