-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Conversation
*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). |
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.
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 |
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.
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; ...”.
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.
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. |
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.
Does someone knows what this option actually does? At least enough to suggest a sentence giving a rough idea of its effect or purpose ^^.
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.
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:: |
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 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)
lib/matplotlib/collections.py
Outdated
zorder of the LineCollection. Default is 2. | ||
|
||
facecolors : optional | ||
The facecolors of the LineCollection. Default is 'none' |
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.
Missing the final period: “... is 'none'.”. (I think)
lib/matplotlib/collections.py
Outdated
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. |
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.
Pure curiosity from myself: is the choice of “line collection” instead of "LineCollection" as in the other docstrings something intentional?
I've made some formatting fixes, but don't really know enough to do the rest. |
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...). |
No description provided.