-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Convert LineCollection docstring to numpydoc #9781
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1171,29 +1171,52 @@ def __init__(self, segments, # Can be None. | |
**kwargs | ||
): | ||
""" | ||
*segments* | ||
a sequence of (*line0*, *line1*, *line2*), where:: | ||
Parameters | ||
---------- | ||
segments : | ||
A sequence of (*line0*, *line1*, *line2*), where:: | ||
|
||
linen = (x0, y0), (x1, y1), ... (xm, ym) | ||
|
||
or the equivalent numpy array with two columns. Each line | ||
can be a different length. | ||
|
||
*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). | ||
|
||
*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 commentThe 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 commentThe 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 |
||
|
||
*linestyles* [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ] | ||
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 commentThe 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) |
||
|
||
(offset, onoffseq), | ||
(offset, onoffseq) | ||
|
||
where *onoffseq* is an even length tuple of on and off ink | ||
where ``onoffseq`` is an even length tuple of on and off ink | ||
in points. | ||
|
||
norm : Normalize, optional | ||
`~.colors.Normalize` instance. | ||
|
||
cmap : string or Colormap, optional | ||
Colormap name or `~.colors.Colormap` instance. | ||
|
||
pickradius : float, optional | ||
The tolerance in points for mouse clicks picking a line. | ||
Default is 5 pt. | ||
|
||
zorder : int, optional | ||
zorder of the LineCollection. Default is 2. | ||
|
||
facecolors : optional | ||
The facecolors of the LineCollection. Default is 'none'. | ||
Setting to a value other than 'none' will lead to a filled | ||
polygon being drawn between points on each line. | ||
|
||
Notes | ||
----- | ||
If *linewidths*, *colors*, or *antialiaseds* is None, they | ||
default to their rcParams setting, in sequence form. | ||
|
||
|
@@ -1210,22 +1233,6 @@ def __init__(self, segments, # Can be None. | |
and this value will be added cumulatively to each successive | ||
segment, so as to produce a set of successively offset curves. | ||
|
||
*norm* | ||
None (optional for :class:`matplotlib.cm.ScalarMappable`) | ||
*cmap* | ||
None (optional for :class:`matplotlib.cm.ScalarMappable`) | ||
|
||
*pickradius* is the tolerance for mouse clicks picking a line. | ||
The default is 5 pt. | ||
|
||
*zorder* | ||
The zorder of the LineCollection. Default is 2 | ||
|
||
*facecolors* | ||
The facecolors of the LineCollection. Default is 'none' | ||
Setting to a value other than 'none' will lead to a filled | ||
polygon being drawn between points on each line. | ||
|
||
The use of :class:`~matplotlib.cm.ScalarMappable` is optional. | ||
If the :class:`~matplotlib.cm.ScalarMappable` array | ||
:attr:`~matplotlib.cm.ScalarMappable._A` is not None (i.e., a call to | ||
|
@@ -1278,6 +1285,13 @@ def set_segments(self, segments): | |
set_paths = set_segments | ||
|
||
def get_segments(self): | ||
""" | ||
Returns | ||
------- | ||
segments : list | ||
List of segments in the LineCollection. Each list item contains an | ||
array of vertices. | ||
""" | ||
segments = [] | ||
|
||
for path in self._paths: | ||
|
@@ -1302,12 +1316,14 @@ def _add_offsets(self, segs): | |
|
||
def set_color(self, c): | ||
""" | ||
Set the color(s) of the line collection. *c* can be a | ||
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 LineCollection. | ||
|
||
ACCEPTS: matplotlib color arg or sequence of rgba tuples | ||
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 commentThe 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 |
||
sequence or rgba tuples; if it is a sequence the patches will | ||
cycle through the sequence. | ||
""" | ||
self.set_edgecolor(c) | ||
self.stale = True | ||
|
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
seems to be fine, even though the colors are given as a list of arbitrary strings when instantiating the line collection.