@@ -1051,30 +1051,44 @@ class PolyCollection(_CollectionWithSizes):
1051
1051
@docstring .dedent_interpd
1052
1052
def __init__ (self , verts , sizes = None , closed = True , ** kwargs ):
1053
1053
"""
1054
- *verts* is a sequence of ( *verts0*, *verts1*, ...) where
1055
- *verts_i* is a sequence of *xy* tuples of vertices, or an
1056
- equivalent :mod:`numpy` array of shape (*nv*, 2).
1057
-
1058
- *sizes* is *None* (default) or a sequence of floats that
1059
- scale the corresponding *verts_i*. The scaling is applied
1060
- before the Artist master transform; if the latter is an identity
1061
- transform, then the overall scaling is such that if
1062
- *verts_i* specify a unit square, then *sizes_i* is the area
1063
- of that square in points^2.
1064
- If len(*sizes*) < *nv*, the additional values will be
1065
- taken cyclically from the array.
1066
-
1067
- *closed*, when *True*, will explicitly close the polygon.
1068
-
1069
- %(Collection)s
1054
+ Parameters
1055
+ ----------
1056
+ verts : sequence
1057
+ The sequence of polygons [*verts0*, *verts1*, ...] where each
1058
+ element *verts_i* defines the vertices of polygon *i* as a 2D
1059
+ array-like of of shape (M, 2).
1060
+ sizes : array-like, default: None
1061
+ Squared scaling factors for the polygons. The coordinates of each
1062
+ polygon *verts_i* are multiplied by the square-root of the
1063
+ corresponding entry in *sizes* (i.e., *sizes* specify the scaling
1064
+ of areas). The scaling is applied before the Artist master
1065
+ transform. If *sizes* is shorter than *verts*, the additional
1066
+ values will be taken cyclically from the *sizes*.
1067
+ closed : bool, default: True
1068
+ Whether the polygon should be closed by adding a CLOSEPOLY
1069
+ connection at the end.
1070
+ **kwargs
1071
+ %(Collection)s
1070
1072
"""
1071
1073
Collection .__init__ (self , ** kwargs )
1072
1074
self .set_sizes (sizes )
1073
1075
self .set_verts (verts , closed )
1074
1076
self .stale = True
1075
1077
1076
1078
def set_verts (self , verts , closed = True ):
1077
- '''This allows one to delay initialization of the vertices.'''
1079
+ """
1080
+ Set the vertices of the polygons.
1081
+
1082
+ Parameters
1083
+ ----------
1084
+ verts : sequence
1085
+ The sequence of polygons [*verts0*, *verts1*, ...] where each
1086
+ element *verts_i* defines the vertices of polygon *i* as a 2D
1087
+ array-like of of shape (M, 2).
1088
+ closed : bool, default: True
1089
+ Whether the polygon should be closed by adding a CLOSEPOLY
1090
+ connection at the end.
1091
+ """
1078
1092
if isinstance (verts , np .ma .MaskedArray ):
1079
1093
verts = verts .astype (float ).filled (np .nan )
1080
1094
# This is much faster than having Path do it one at a time.
@@ -1122,13 +1136,14 @@ class BrokenBarHCollection(PolyCollection):
1122
1136
@docstring .dedent_interpd
1123
1137
def __init__ (self , xranges , yrange , ** kwargs ):
1124
1138
"""
1125
- *xranges*
1126
- sequence of (*xmin*, *xwidth*)
1127
-
1128
- *yrange*
1129
- *ymin*, *ywidth*
1130
-
1131
- %(Collection)s
1139
+ Parameters
1140
+ ----------
1141
+ xranges : sequence of (float, float)
1142
+ The sequence of (left-edge-position, width) pairs for each bar.
1143
+ yrange : (float, float)
1144
+ The (lower-edge, height) common to all bars.
1145
+ **kwargs
1146
+ %(Collection)s
1132
1147
"""
1133
1148
ymin , ywidth = yrange
1134
1149
ymax = ymin + ywidth
@@ -1162,7 +1177,7 @@ def span_where(x, ymin, ymax, where, **kwargs):
1162
1177
1163
1178
1164
1179
class RegularPolyCollection (_CollectionWithSizes ):
1165
- """Draw a collection of regular polygons with *numsides* ."""
1180
+ """A collection of n-sided regular polygons."""
1166
1181
1167
1182
_path_generator = mpath .Path .unit_regular_polygon
1168
1183
_factor = np .pi ** (- 1 / 2 )
@@ -1174,20 +1189,24 @@ def __init__(self,
1174
1189
sizes = (1 ,),
1175
1190
** kwargs ):
1176
1191
"""
1177
- *numsides*
1178
- the number of sides of the polygon
1179
-
1180
- *rotation*
1181
- the rotation of the polygon in radians
1182
-
1183
- *sizes*
1184
- gives the area of the circle circumscribing the
1185
- regular polygon in points^2
1192
+ Parameters
1193
+ ----------
1194
+ numsides : int
1195
+ The number of sides of the polygon.
1196
+ rotation : float
1197
+ The rotation of the polygon in radians.
1198
+ sizes : tuple of float
1199
+ The area of the circle circumscribing the polygon in points^2.
1186
1200
1187
- %(Collection)s
1201
+ Other Parameters
1202
+ ----------------
1203
+ **kwargs
1204
+ Other keyword arguments.
1205
+ %(Collection)s
1188
1206
1189
- Example: see :doc:`/gallery/event_handling/lasso_demo` for a
1190
- complete example::
1207
+ Examples
1208
+ --------
1209
+ See :doc:`/gallery/event_handling/lasso_demo` for a complete example::
1191
1210
1192
1211
offsets = np.random.rand(20, 2)
1193
1212
facecolors = [cm.jet(x) for x in np.random.rand(20)]
0 commit comments