Skip to content

Commit a5fb352

Browse files
authored
Merge pull request #9781 from dstansby/linecollection-docstring
Convert LineCollection docstring to numpydoc
2 parents fa44c87 + f713ea5 commit a5fb352

File tree

1 file changed

+47
-31
lines changed

1 file changed

+47
-31
lines changed

lib/matplotlib/collections.py

+47-31
Original file line numberDiff line numberDiff line change
@@ -1171,29 +1171,52 @@ def __init__(self, segments, # Can be None.
11711171
**kwargs
11721172
):
11731173
"""
1174-
*segments*
1175-
a sequence of (*line0*, *line1*, *line2*), where::
1174+
Parameters
1175+
----------
1176+
segments :
1177+
A sequence of (*line0*, *line1*, *line2*), where::
11761178
11771179
linen = (x0, y0), (x1, y1), ... (xm, ym)
11781180
11791181
or the equivalent numpy array with two columns. Each line
11801182
can be a different length.
11811183
1182-
*colors*
1183-
must be a sequence of RGBA tuples (e.g., arbitrary color
1184+
colors : sequence, optional
1185+
A sequence of RGBA tuples (e.g., arbitrary color
11841186
strings, etc, not allowed).
11851187
1186-
*antialiaseds*
1187-
must be a sequence of ones or zeros
1188+
antialiaseds : sequence, optional
1189+
A sequence of ones or zeros.
11881190
1189-
*linestyles* [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
1190-
a string or dash tuple. The dash tuple is::
1191+
linestyles : string, tuple, optional
1192+
Either one of [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ], or
1193+
a dash tuple. The dash tuple is::
11911194
1192-
(offset, onoffseq),
1195+
(offset, onoffseq)
11931196
1194-
where *onoffseq* is an even length tuple of on and off ink
1197+
where ``onoffseq`` is an even length tuple of on and off ink
11951198
in points.
11961199
1200+
norm : Normalize, optional
1201+
`~.colors.Normalize` instance.
1202+
1203+
cmap : string or Colormap, optional
1204+
Colormap name or `~.colors.Colormap` instance.
1205+
1206+
pickradius : float, optional
1207+
The tolerance in points for mouse clicks picking a line.
1208+
Default is 5 pt.
1209+
1210+
zorder : int, optional
1211+
zorder of the LineCollection. Default is 2.
1212+
1213+
facecolors : optional
1214+
The facecolors of the LineCollection. Default is 'none'.
1215+
Setting to a value other than 'none' will lead to a filled
1216+
polygon being drawn between points on each line.
1217+
1218+
Notes
1219+
-----
11971220
If *linewidths*, *colors*, or *antialiaseds* is None, they
11981221
default to their rcParams setting, in sequence form.
11991222
@@ -1210,22 +1233,6 @@ def __init__(self, segments, # Can be None.
12101233
and this value will be added cumulatively to each successive
12111234
segment, so as to produce a set of successively offset curves.
12121235
1213-
*norm*
1214-
None (optional for :class:`matplotlib.cm.ScalarMappable`)
1215-
*cmap*
1216-
None (optional for :class:`matplotlib.cm.ScalarMappable`)
1217-
1218-
*pickradius* is the tolerance for mouse clicks picking a line.
1219-
The default is 5 pt.
1220-
1221-
*zorder*
1222-
The zorder of the LineCollection. Default is 2
1223-
1224-
*facecolors*
1225-
The facecolors of the LineCollection. Default is 'none'
1226-
Setting to a value other than 'none' will lead to a filled
1227-
polygon being drawn between points on each line.
1228-
12291236
The use of :class:`~matplotlib.cm.ScalarMappable` is optional.
12301237
If the :class:`~matplotlib.cm.ScalarMappable` array
12311238
:attr:`~matplotlib.cm.ScalarMappable._A` is not None (i.e., a call to
@@ -1278,6 +1285,13 @@ def set_segments(self, segments):
12781285
set_paths = set_segments
12791286

12801287
def get_segments(self):
1288+
"""
1289+
Returns
1290+
-------
1291+
segments : list
1292+
List of segments in the LineCollection. Each list item contains an
1293+
array of vertices.
1294+
"""
12811295
segments = []
12821296

12831297
for path in self._paths:
@@ -1302,12 +1316,14 @@ def _add_offsets(self, segs):
13021316

13031317
def set_color(self, c):
13041318
"""
1305-
Set the color(s) of the line collection. *c* can be a
1306-
matplotlib color arg (all patches have same color), or a
1307-
sequence or rgba tuples; if it is a sequence the patches will
1308-
cycle through the sequence.
1319+
Set the color(s) of the LineCollection.
13091320
1310-
ACCEPTS: matplotlib color arg or sequence of rgba tuples
1321+
Parameters
1322+
----------
1323+
c :
1324+
Matplotlib color argument (all patches have same color), or a
1325+
sequence or rgba tuples; if it is a sequence the patches will
1326+
cycle through the sequence.
13111327
"""
13121328
self.set_edgecolor(c)
13131329
self.stale = True

0 commit comments

Comments
 (0)