Skip to content
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

Convert LineCollection docstring to numpydoc #9781

Merged
merged 2 commits into from
Nov 28, 2017

Conversation

dstansby
Copy link
Member

No description provided.

*colors*
must be a sequence of RGBA tuples (e.g., arbitrary color
colors : sequence, optional
A sequence of RGBA tuples (e.g., arbitrary color
strings, etc, not allowed).
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still true? I am wondering because the following

import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
plt.ion()

coll = LineCollection([[[0, 0], [1, 1]], [[0, 1], [1, 0]]],
                      colors=["tab:gray", "tab:green"])

fig, ax = plt.subplots()
ax.add_collection(coll)

print("Click on the figure to change the colors")
plt.ginput(1)

coll.set_color(["tab:red", "tab:purple"])

seems to be fine, even though the colors are given as a list of arbitrary strings when instantiating the line collection.

Parameters
----------
c :
Matplotlib color argument (all patches have same color), or a
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, as for the colors parameter in the class constructor, it seems to me that one does not have anymore to use exclusively an RGBA sequence to define every color independently. See the second half of the example that I gave above.

NB: looking at the former docstring (more precisely to the “ACCEPTS:...” part), I have the feeling that there was a typo in “... a sequence or of rgba tuples; ...”.

Copy link
Contributor

@afvincent afvincent left a comment

Choose a reason for hiding this comment

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

A few minor remarks, but otherwise LGTM :).

*antialiaseds*
must be a sequence of ones or zeros
antialiaseds : sequence, optional
A sequence of ones or zeros.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does someone knows what this option actually does? At least enough to suggest a sentence giving a rough idea of its effect or purpose ^^.

Copy link
Member

Choose a reason for hiding this comment

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

it controls if any given line segment is anti-aliased when drawn. This gets handed through to the gc object and may or may not be respected by all of the backends. I think it should be read as (antialiased (s) like linestyle (s)).

a string or dash tuple. The dash tuple is::
linestyles : string, tuple, optional
Either one of [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ], or
a dash tuple. The dash tuple is::
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if the short names are also fine (I mean "-", "--", "-.", ":")? (And possibly some other exotic options sometimes accepted by some methods and classes related to lines)

zorder of the LineCollection. Default is 2.

facecolors : optional
The facecolors of the LineCollection. Default is 'none'
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing the final period: “... is 'none'.”. (I think)

matplotlib color arg (all patches have same color), or a
sequence or rgba tuples; if it is a sequence the patches will
cycle through the sequence.
Set the color(s) of the line collection.
Copy link
Contributor

Choose a reason for hiding this comment

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

Pure curiosity from myself: is the choice of “line collection” instead of "LineCollection" as in the other docstrings something intentional?

@dstansby dstansby added this to the v2.2 milestone Nov 22, 2017
@dstansby
Copy link
Member Author

I've made some formatting fixes, but don't really know enough to do the rest.

@anntzer
Copy link
Contributor

anntzer commented Nov 28, 2017

While further improvements are possible, this is already better and @dstansby signaled that he doesn't intend to write the additional fixes, so they may go in an separate PR (@afvincent if you want to take a shot at it...).

@anntzer anntzer merged commit a5fb352 into matplotlib:master Nov 28, 2017
@afvincent
Copy link
Contributor

@anntzer Fair enough ;). I am likely to have rather limited bandwidth during the next month (and I have another couple of open PRs that I do not want them to stall either in the meantime) but I'll see what I can do.

@dstansby Thanks for the fixes :)

@dstansby dstansby deleted the linecollection-docstring branch December 6, 2017 10:43
@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