Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bbdf68

Browse files
committed
DOCS: more @timhoffm's suggestions, collections.py
1 parent 33498df commit 8bbdf68

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

lib/matplotlib/collections.py

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,25 @@ class Collection(artist.Artist, cm.ScalarMappable):
3030
r"""
3131
Base class for Collections. Must be subclassed to be usable.
3232
33-
A Collection represents a sequence of `~.patches.Patch`\s that can be drawn
33+
A Collection represents a sequence of `.Patch`\s that can be drawn
3434
more efficiently together than individually. For example, when a single
3535
path is being drawn repeatedly at different offsets, the renderer can
3636
typically execute a ``draw_marker()`` call much more efficiently than a
3737
series of repeated calls to ``draw_path()`` with the offsets put in
3838
one-by-one.
3939
4040
Most properties of a collection can be configured per-element. Therefore,
41-
Collections have "plural" versions of many of the properties of a
42-
`~.patches.Patch` (e.g. `.Collection.get_paths` instead of
43-
`~.patches.Patch.get_path`). Exceptions are the *zorder*, *hatch*,
44-
*pickradius*, *capstyle* and *joinstyle* properties, which can only be set
45-
globally for the whole collection.
41+
Collections have "plural" versions of many of the properties of a `.Patch`
42+
(e.g. `.Collection.get_paths` instead of `.Patch.get_path`). Exceptions are
43+
the *zorder*, *hatch*, *pickradius*, *capstyle* and *joinstyle* properties,
44+
which can only be set globally for the whole collection.
4645
4746
Besides these exceptions, all properties can be specified as single values
4847
(applying to all elements) or sequences of values. The property of the
49-
``i``th element of the collection is::
48+
``i``\th element of the collection is::
5049
5150
prop[i % len(prop)]
5251
53-
5452
Each Collection can optionally be used as its own `~.cm.ScalarMappable` by
5553
passing the *norm* and *cmap* parameters to its constructor. If the
5654
Collection's `~.cm.ScalarMappable` matrix ``_A`` has been set (via a call
@@ -129,15 +127,15 @@ def __init__(self,
129127
offset_position : {'screen' (default), 'data' (deprecated)}
130128
If set to 'data' (deprecated), *offsets* will be treated as if it
131129
is in data coordinates instead of in screen coordinates.
132-
norm : `~.colors.Normalize`, optional, default: None
130+
norm : `~.colors.Normalize`, optional
133131
Forwarded to `~.cm.ScalarMappable`. The default of
134132
``None`` means that the first draw call will set ``vmin`` and
135133
``vmax`` using the minimum and maximum values of the data.
136-
cmap : `~.colors.Colormap`, optional, default: None
134+
cmap : `~.colors.Colormap`, optional
137135
Forwarded to `~.cm.ScalarMappable`. The default of
138136
``None`` will result in :rc:`image.cmap` being used.
139-
hatch : str, optional, default: None
140-
Hatching pattern to use in filled paths, if any. Valid strings are
137+
hatch : str, optional
138+
Hatching pattern to use in filled paths, if any. Valid strings are
141139
['/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*']. See
142140
:doc:`/gallery/shapes_and_collections/hatch_demo` for the meaning
143141
of each hatch type.
@@ -148,7 +146,7 @@ def __init__(self,
148146
other hand, if it is greater than 0, then we instead check if the
149147
test point is contained in a stroke of width ``2*pickradius``
150148
following any of the Paths in the Collection.
151-
urls : list of str, optional, default: None
149+
urls : list of str, default: None
152150
A URL for each patch to link to once drawn. Currently only works
153151
for the SVG backend. See :doc:`/gallery/misc/hyperlinks_sgskip` for
154152
examples.
@@ -468,7 +466,7 @@ def set_urls(self, urls):
468466
"""
469467
Parameters
470468
----------
471-
urls : sequence of str or None
469+
urls : list of str or None
472470
473471
Notes
474472
-----
@@ -726,7 +724,7 @@ def set_antialiased(self, aa):
726724
727725
Parameters
728726
----------
729-
aa : bool or sequence of bools
727+
aa : bool or list of bools
730728
"""
731729
if aa is None:
732730
aa = mpl.rcParams['patch.antialiased']
@@ -739,7 +737,7 @@ def set_color(self, c):
739737
740738
Parameters
741739
----------
742-
c : color or sequence of rgba tuples
740+
c : color or list of rgba tuples
743741
744742
See Also
745743
--------
@@ -772,7 +770,7 @@ def set_facecolor(self, c):
772770
773771
Parameters
774772
----------
775-
c : color or sequence of colors
773+
c : color or list of colors
776774
"""
777775
self._original_facecolor = c
778776
self._set_facecolor(c)
@@ -820,7 +818,7 @@ def set_edgecolor(self, c):
820818
821819
Parameters
822820
----------
823-
c : color or sequence of colors or 'face'
821+
c : color or list of colors or 'face'
824822
The collection edgecolor(s). If a sequence, the patches cycle
825823
through it. If 'face', match the facecolor.
826824
"""
@@ -938,9 +936,9 @@ def __init__(self, paths, sizes=None, **kwargs):
938936
"""
939937
Parameters
940938
----------
941-
paths : list of matplotlib.path.Path
939+
paths : list of `.path.Path`
942940
The paths that will make up the `.Collection`.
943-
sizes : array-like of float
941+
sizes : array-like
944942
The factor by which to scale each drawn `~.path.Path`. One unit
945943
squared in the Path's data space is scaled to be ``sizes**2``
946944
points when rendered.
@@ -1102,11 +1100,11 @@ def __init__(self, verts, sizes=None, closed=True, **kwargs):
11021100
"""
11031101
Parameters
11041102
----------
1105-
verts : sequence of array-like
1103+
verts : list of array-like
11061104
The sequence of polygons [*verts0*, *verts1*, ...] where each
11071105
element *verts_i* defines the vertices of polygon *i* as a 2D
11081106
array-like of of shape (M, 2).
1109-
sizes : array-like of float, default: None
1107+
sizes : array-like, default: None
11101108
Squared scaling factors for the polygons. The coordinates of each
11111109
polygon *verts_i* are multiplied by the square-root of the
11121110
corresponding entry in *sizes* (i.e., *sizes* specify the scaling
@@ -1129,7 +1127,7 @@ def set_verts(self, verts, closed=True):
11291127
11301128
Parameters
11311129
----------
1132-
verts : sequence
1130+
verts : list of array-like
11331131
The sequence of polygons [*verts0*, *verts1*, ...] where each
11341132
element *verts_i* defines the vertices of polygon *i* as a 2D
11351133
array-like of of shape (M, 2).
@@ -1194,7 +1192,7 @@ def __init__(self, xranges, yrange, **kwargs):
11941192
"""
11951193
Parameters
11961194
----------
1197-
xranges : sequence of (float, float)
1195+
xranges : list of (float, float)
11981196
The sequence of (left-edge-position, width) pairs for each bar.
11991197
yrange : (float, float)
12001198
The (lower-edge, height) common to all bars.
@@ -1315,7 +1313,7 @@ class LineCollection(Collection):
13151313
prop[i % len(prop)]
13161314
13171315
A *LineCollection*'s properties default to their ``'lines'`` values in
1318-
`~.matplotlib.rcParams` instead of their ``'patch'`` values, and the
1316+
`~.rcParams` instead of their ``'patch'`` values, and the
13191317
property *colors* is added in place of *edgecolors*.
13201318
"""
13211319

@@ -1338,7 +1336,7 @@ def __init__(self, segments, # Can be None.
13381336
"""
13391337
Parameters
13401338
----------
1341-
segments: sequence of array-like
1339+
segments: list of array-like
13421340
A sequence of (*line0*, *line1*, *line2*), where::
13431341
13441342
linen = (x0, y0), (x1, y1), ... (xm, ym)
@@ -1669,7 +1667,7 @@ def __init__(self, sizes, **kwargs):
16691667
Parameters
16701668
----------
16711669
sizes : float or array-like
1672-
Gives the area of each circle in points^2.
1670+
The area of each circle in points^2.
16731671
**kwargs
16741672
Forwarded to `.Collection`.
16751673
"""

0 commit comments

Comments
 (0)