@@ -930,7 +930,7 @@ def set_sizes(self, sizes, dpi=72.0):
930930 @artist .allow_rasterization
931931 def draw (self , renderer ):
932932 self .set_sizes (self ._sizes , self .figure .dpi )
933- Collection .draw (self , renderer )
933+ super () .draw (renderer )
934934
935935
936936class PathCollection (_CollectionWithSizes ):
@@ -1122,7 +1122,7 @@ def __init__(self, verts, sizes=None, closed=True, **kwargs):
11221122 **kwargs
11231123 Forwarded to `.Collection`.
11241124 """
1125- Collection .__init__ (self , ** kwargs )
1125+ super () .__init__ (** kwargs )
11261126 self .set_sizes (sizes )
11271127 self .set_verts (verts , closed )
11281128 self .stale = True
@@ -1212,7 +1212,7 @@ def __init__(self, xranges, yrange, **kwargs):
12121212 (xmin + xwidth , ymax ),
12131213 (xmin + xwidth , ymin ),
12141214 (xmin , ymin )] for xmin , xwidth in xranges ]
1215- PolyCollection .__init__ (self , verts , ** kwargs )
1215+ super () .__init__ (verts , ** kwargs )
12161216
12171217 @classmethod
12181218 def span_where (cls , x , ymin , ymax , where , ** kwargs ):
@@ -1272,7 +1272,7 @@ def __init__(self,
12721272 transOffset=ax.transData,
12731273 )
12741274 """
1275- Collection .__init__ (self , ** kwargs )
1275+ super () .__init__ (** kwargs )
12761276 self .set_sizes (sizes )
12771277 self ._numsides = numsides
12781278 self ._paths = [self ._path_generator (numsides )]
@@ -1292,6 +1292,8 @@ def draw(self, renderer):
12921292 transforms .Affine2D (x ).rotate (- self ._rotation ).get_matrix ()
12931293 for x in self ._transforms
12941294 ]
1295+ # Explicitly not super().draw, because set_sizes must be called before
1296+ # updating self._transforms.
12951297 Collection .draw (self , renderer )
12961298
12971299
@@ -1378,8 +1380,7 @@ def __init__(self, segments, # Can be None.
13781380 antialiaseds = (mpl .rcParams ['lines.antialiased' ],)
13791381
13801382 colors = mcolors .to_rgba_array (colors )
1381- Collection .__init__ (
1382- self ,
1383+ super ().__init__ (
13831384 edgecolors = colors ,
13841385 facecolors = facecolors ,
13851386 linewidths = linewidths ,
@@ -1520,13 +1521,10 @@ def __init__(self,
15201521 --------
15211522 .. plot:: gallery/lines_bars_and_markers/eventcollection_demo.py
15221523 """
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 )
15301528 self ._is_horizontal = True # Initial value, may be switched below.
15311529 self ._linelength = linelength
15321530 self ._lineoffset = lineoffset
@@ -1677,7 +1675,7 @@ def __init__(self, sizes, **kwargs):
16771675 **kwargs
16781676 Forwarded to `.Collection`.
16791677 """
1680- Collection .__init__ (self , ** kwargs )
1678+ super () .__init__ (** kwargs )
16811679 self .set_sizes (sizes )
16821680 self .set_transform (transforms .IdentityTransform ())
16831681 self ._paths = [mpath .Path .unit_circle ()]
@@ -1711,7 +1709,7 @@ def __init__(self, widths, heights, angles, units='points', **kwargs):
17111709 **kwargs
17121710 Forwarded to `Collection`.
17131711 """
1714- Collection .__init__ (self , ** kwargs )
1712+ super () .__init__ (** kwargs )
17151713 self ._widths = 0.5 * np .asarray (widths ).ravel ()
17161714 self ._heights = 0.5 * np .asarray (heights ).ravel ()
17171715 self ._angles = np .deg2rad (angles ).ravel ()
@@ -1765,7 +1763,7 @@ def _set_transforms(self):
17651763 @artist .allow_rasterization
17661764 def draw (self , renderer ):
17671765 self ._set_transforms ()
1768- Collection .draw (self , renderer )
1766+ super () .draw (renderer )
17691767
17701768
17711769class PatchCollection (Collection ):
@@ -1813,7 +1811,7 @@ def determine_facecolor(patch):
18131811 kwargs ['linestyles' ] = [p .get_linestyle () for p in patches ]
18141812 kwargs ['antialiaseds' ] = [p .get_antialiased () for p in patches ]
18151813
1816- Collection .__init__ (self , ** kwargs )
1814+ super () .__init__ (** kwargs )
18171815
18181816 self .set_paths (patches )
18191817
@@ -1830,7 +1828,7 @@ class TriMesh(Collection):
18301828 A triangular mesh is a `~matplotlib.tri.Triangulation` object.
18311829 """
18321830 def __init__ (self , triangulation , ** kwargs ):
1833- Collection .__init__ (self , ** kwargs )
1831+ super () .__init__ (** kwargs )
18341832 self ._triangulation = triangulation
18351833 self ._shading = 'gouraud'
18361834 self ._is_filled = True
@@ -1918,7 +1916,7 @@ class QuadMesh(Collection):
19181916 """
19191917 def __init__ (self , meshWidth , meshHeight , coordinates ,
19201918 antialiased = True , shading = 'flat' , ** kwargs ):
1921- Collection .__init__ (self , ** kwargs )
1919+ super () .__init__ (** kwargs )
19221920 self ._meshWidth = meshWidth
19231921 self ._meshHeight = meshHeight
19241922 # By converting to floats now, we can avoid that on every draw.
0 commit comments