diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 8a7c0e67a6a9..4e2aa1926bd9 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -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. - *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:: - (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 + sequence or rgba tuples; if it is a sequence the patches will + cycle through the sequence. """ self.set_edgecolor(c) self.stale = True