@@ -930,7 +930,7 @@ def set_sizes(self, sizes, dpi=72.0):
930
930
@artist .allow_rasterization
931
931
def draw (self , renderer ):
932
932
self .set_sizes (self ._sizes , self .figure .dpi )
933
- Collection .draw (self , renderer )
933
+ super () .draw (renderer )
934
934
935
935
936
936
class PathCollection (_CollectionWithSizes ):
@@ -1122,7 +1122,7 @@ def __init__(self, verts, sizes=None, closed=True, **kwargs):
1122
1122
**kwargs
1123
1123
Forwarded to `.Collection`.
1124
1124
"""
1125
- Collection .__init__ (self , ** kwargs )
1125
+ super () .__init__ (** kwargs )
1126
1126
self .set_sizes (sizes )
1127
1127
self .set_verts (verts , closed )
1128
1128
self .stale = True
@@ -1212,7 +1212,7 @@ def __init__(self, xranges, yrange, **kwargs):
1212
1212
(xmin + xwidth , ymax ),
1213
1213
(xmin + xwidth , ymin ),
1214
1214
(xmin , ymin )] for xmin , xwidth in xranges ]
1215
- PolyCollection .__init__ (self , verts , ** kwargs )
1215
+ super () .__init__ (verts , ** kwargs )
1216
1216
1217
1217
@classmethod
1218
1218
def span_where (cls , x , ymin , ymax , where , ** kwargs ):
@@ -1272,7 +1272,7 @@ def __init__(self,
1272
1272
transOffset=ax.transData,
1273
1273
)
1274
1274
"""
1275
- Collection .__init__ (self , ** kwargs )
1275
+ super () .__init__ (** kwargs )
1276
1276
self .set_sizes (sizes )
1277
1277
self ._numsides = numsides
1278
1278
self ._paths = [self ._path_generator (numsides )]
@@ -1292,6 +1292,8 @@ def draw(self, renderer):
1292
1292
transforms .Affine2D (x ).rotate (- self ._rotation ).get_matrix ()
1293
1293
for x in self ._transforms
1294
1294
]
1295
+ # Explicitly not super().draw, because set_sizes must be called before
1296
+ # updating self._transforms.
1295
1297
Collection .draw (self , renderer )
1296
1298
1297
1299
@@ -1378,8 +1380,7 @@ def __init__(self, segments, # Can be None.
1378
1380
antialiaseds = (mpl .rcParams ['lines.antialiased' ],)
1379
1381
1380
1382
colors = mcolors .to_rgba_array (colors )
1381
- Collection .__init__ (
1382
- self ,
1383
+ super ().__init__ (
1383
1384
edgecolors = colors ,
1384
1385
facecolors = facecolors ,
1385
1386
linewidths = linewidths ,
@@ -1520,13 +1521,10 @@ def __init__(self,
1520
1521
--------
1521
1522
.. plot:: gallery/lines_bars_and_markers/eventcollection_demo.py
1522
1523
"""
1523
- LineCollection .__init__ (self ,
1524
- [],
1525
- linewidths = linewidth ,
1526
- colors = color ,
1527
- antialiaseds = antialiased ,
1528
- linestyles = linestyle ,
1529
- ** kwargs )
1524
+ super ().__init__ ([],
1525
+ linewidths = linewidth , linestyles = linestyle ,
1526
+ colors = color , antialiaseds = antialiased ,
1527
+ ** kwargs )
1530
1528
self ._is_horizontal = True # Initial value, may be switched below.
1531
1529
self ._linelength = linelength
1532
1530
self ._lineoffset = lineoffset
@@ -1677,7 +1675,7 @@ def __init__(self, sizes, **kwargs):
1677
1675
**kwargs
1678
1676
Forwarded to `.Collection`.
1679
1677
"""
1680
- Collection .__init__ (self , ** kwargs )
1678
+ super () .__init__ (** kwargs )
1681
1679
self .set_sizes (sizes )
1682
1680
self .set_transform (transforms .IdentityTransform ())
1683
1681
self ._paths = [mpath .Path .unit_circle ()]
@@ -1711,7 +1709,7 @@ def __init__(self, widths, heights, angles, units='points', **kwargs):
1711
1709
**kwargs
1712
1710
Forwarded to `Collection`.
1713
1711
"""
1714
- Collection .__init__ (self , ** kwargs )
1712
+ super () .__init__ (** kwargs )
1715
1713
self ._widths = 0.5 * np .asarray (widths ).ravel ()
1716
1714
self ._heights = 0.5 * np .asarray (heights ).ravel ()
1717
1715
self ._angles = np .deg2rad (angles ).ravel ()
@@ -1765,7 +1763,7 @@ def _set_transforms(self):
1765
1763
@artist .allow_rasterization
1766
1764
def draw (self , renderer ):
1767
1765
self ._set_transforms ()
1768
- Collection .draw (self , renderer )
1766
+ super () .draw (renderer )
1769
1767
1770
1768
1771
1769
class PatchCollection (Collection ):
@@ -1813,7 +1811,7 @@ def determine_facecolor(patch):
1813
1811
kwargs ['linestyles' ] = [p .get_linestyle () for p in patches ]
1814
1812
kwargs ['antialiaseds' ] = [p .get_antialiased () for p in patches ]
1815
1813
1816
- Collection .__init__ (self , ** kwargs )
1814
+ super () .__init__ (** kwargs )
1817
1815
1818
1816
self .set_paths (patches )
1819
1817
@@ -1830,7 +1828,7 @@ class TriMesh(Collection):
1830
1828
A triangular mesh is a `~matplotlib.tri.Triangulation` object.
1831
1829
"""
1832
1830
def __init__ (self , triangulation , ** kwargs ):
1833
- Collection .__init__ (self , ** kwargs )
1831
+ super () .__init__ (** kwargs )
1834
1832
self ._triangulation = triangulation
1835
1833
self ._shading = 'gouraud'
1836
1834
self ._is_filled = True
@@ -1918,7 +1916,7 @@ class QuadMesh(Collection):
1918
1916
"""
1919
1917
def __init__ (self , meshWidth , meshHeight , coordinates ,
1920
1918
antialiased = True , shading = 'flat' , ** kwargs ):
1921
- Collection .__init__ (self , ** kwargs )
1919
+ super () .__init__ (** kwargs )
1922
1920
self ._meshWidth = meshWidth
1923
1921
self ._meshHeight = meshHeight
1924
1922
# By converting to floats now, we can avoid that on every draw.
0 commit comments