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

Skip to content

Commit cb8c65b

Browse files
committed
Use super() more in Axes/Axis.
1 parent 3d20859 commit cb8c65b

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

examples/misc/custom_projection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _init_axis(self):
5353
self._update_transScale()
5454

5555
def cla(self):
56-
Axes.cla(self)
56+
super().cla()
5757

5858
self.set_longitude_grid(30)
5959
self.set_latitude_grid(15)
@@ -426,7 +426,7 @@ def inverted(self):
426426

427427
def __init__(self, *args, **kwargs):
428428
self._longitude_cap = np.pi / 2.0
429-
GeoAxes.__init__(self, *args, **kwargs)
429+
super().__init__(*args, **kwargs)
430430
self.set_aspect(0.5, adjustable='box', anchor='C')
431431
self.cla()
432432

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def __init__(self, fig, rect,
476476
The new `~.axes.Axes` object.
477477
"""
478478

479-
martist.Artist.__init__(self)
479+
super().__init__()
480480
if isinstance(rect, mtransforms.Bbox):
481481
self._position = rect
482482
else:
@@ -625,7 +625,7 @@ def _init_axis(self):
625625

626626
def set_figure(self, fig):
627627
# docstring inherited
628-
martist.Artist.set_figure(self, fig)
628+
super().set_figure(fig)
629629

630630
self.bbox = mtransforms.TransformedBbox(self._position,
631631
fig.transFigure)

lib/matplotlib/axis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __init__(self, axes, loc, label=None,
8282
loc is the tick location in data coords
8383
size is the tick size in points
8484
"""
85-
martist.Artist.__init__(self)
85+
super().__init__()
8686

8787
if gridOn is None:
8888
if major and (mpl.rcParams['axes.grid.which']
@@ -231,7 +231,7 @@ def get_children(self):
231231

232232
def set_clip_path(self, clippath, transform=None):
233233
# docstring inherited
234-
martist.Artist.set_clip_path(self, clippath, transform)
234+
super().set_clip_path(clippath, transform)
235235
self.gridline.set_clip_path(clippath, transform)
236236
self.stale = True
237237

@@ -675,7 +675,7 @@ def __init__(self, axes, pickradius=15):
675675
The acceptance radius for containment tests. See also
676676
`.Axis.contains`.
677677
"""
678-
martist.Artist.__init__(self)
678+
super().__init__()
679679
self._remove_overlapping_locs = True
680680

681681
self.set_figure(axes.figure)
@@ -901,7 +901,7 @@ def _translate_tick_kw(kw):
901901
return kwtrans
902902

903903
def set_clip_path(self, clippath, transform=None):
904-
martist.Artist.set_clip_path(self, clippath, transform)
904+
super().set_clip_path(clippath, transform)
905905
for child in self.majorTicks + self.minorTicks:
906906
child.set_clip_path(clippath, transform)
907907
self.stale = True

lib/matplotlib/projections/geo.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _init_axis(self):
3737
self._update_transScale()
3838

3939
def cla(self):
40-
Axes.cla(self)
40+
super().cla()
4141

4242
self.set_longitude_grid(30)
4343
self.set_latitude_grid(15)
@@ -290,7 +290,7 @@ def inverted(self):
290290

291291
def __init__(self, *args, **kwargs):
292292
self._longitude_cap = np.pi / 2.0
293-
GeoAxes.__init__(self, *args, **kwargs)
293+
super().__init__(*args, **kwargs)
294294
self.set_aspect(0.5, adjustable='box', anchor='C')
295295
self.cla()
296296

@@ -335,7 +335,7 @@ def inverted(self):
335335

336336
def __init__(self, *args, **kwargs):
337337
self._longitude_cap = np.pi / 2.0
338-
GeoAxes.__init__(self, *args, **kwargs)
338+
super().__init__(*args, **kwargs)
339339
self.set_aspect(0.5, adjustable='box', anchor='C')
340340
self.cla()
341341

@@ -405,7 +405,7 @@ def inverted(self):
405405

406406
def __init__(self, *args, **kwargs):
407407
self._longitude_cap = np.pi / 2.0
408-
GeoAxes.__init__(self, *args, **kwargs)
408+
super().__init__(*args, **kwargs)
409409
self.set_aspect(0.5, adjustable='box', anchor='C')
410410
self.cla()
411411

@@ -490,12 +490,12 @@ def __init__(self, *args, center_longitude=0, center_latitude=0, **kwargs):
490490
self._longitude_cap = np.pi / 2
491491
self._center_longitude = center_longitude
492492
self._center_latitude = center_latitude
493-
GeoAxes.__init__(self, *args, **kwargs)
493+
super().__init__(*args, **kwargs)
494494
self.set_aspect('equal', adjustable='box', anchor='C')
495495
self.cla()
496496

497497
def cla(self):
498-
GeoAxes.cla(self)
498+
super().cla()
499499
self.yaxis.set_major_formatter(NullFormatter())
500500

501501
def _get_core_transform(self, resolution):

lib/matplotlib/projections/polar.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ def __init__(self, *args,
793793
self.cla()
794794

795795
def cla(self):
796-
Axes.cla(self)
796+
super().cla()
797797

798798
self.title.set_y(1.05)
799799

@@ -991,7 +991,7 @@ def draw(self, renderer, *args, **kwargs):
991991
self.yaxis.reset_ticks()
992992
self.yaxis.set_clip_path(self.patch)
993993

994-
Axes.draw(self, renderer, *args, **kwargs)
994+
super().draw(renderer, *args, **kwargs)
995995

996996
def _gen_axes_patch(self):
997997
return mpatches.Wedge((0.5, 0.5), 0.5, 0.0, 360.0)
@@ -1289,7 +1289,7 @@ def set_rlabel_position(self, value):
12891289
self._r_label_position.clear().translate(np.deg2rad(value), 0.0)
12901290

12911291
def set_yscale(self, *args, **kwargs):
1292-
Axes.set_yscale(self, *args, **kwargs)
1292+
super().set_yscale(*args, **kwargs)
12931293
self.yaxis.set_major_locator(
12941294
self.RadialLocator(self.yaxis.get_major_locator(), self))
12951295

lib/matplotlib/tests/test_skew.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _set_lim_and_transforms(self):
9797
rot = 30
9898

9999
# Get the standard transform setup from the Axes base class
100-
Axes._set_lim_and_transforms(self)
100+
super()._set_lim_and_transforms()
101101

102102
# Need to put the skew in the middle, after the scale and limits,
103103
# but before the transAxes. This way, the skew is done in Axes

lib/mpl_toolkits/axes_grid1/mpl_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __init__(self, axis, axisnum, spine):
7272
else:
7373
raise ValueError(
7474
f"axis must be instance of XAxis or YAxis, but got {axis}")
75-
Artist.__init__(self)
75+
super().__init__()
7676

7777
@property
7878
def major_ticks(self):
@@ -94,7 +94,7 @@ def set_visible(self, b):
9494
self.toggle(all=b)
9595
self.line.set_visible(b)
9696
self._axis.set_visible(True)
97-
Artist.set_visible(self, b)
97+
super().set_visible(b)
9898

9999
def set_label(self, txt):
100100
self._axis.set_label_text(txt)

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class TickLabels(AxisLabel): # mtext.Text
487487
"""
488488

489489
def __init__(self, *, axis_direction="bottom", **kwargs):
490-
AxisLabel.__init__(self, **kwargs)
490+
super().__init__(**kwargs)
491491
self.set_axis_direction(axis_direction)
492492
self._axislabel_pad = 0
493493

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __init__(self, adir, v_intervalx, d_intervalx, axes, *args,
103103
},
104104
})
105105

106-
maxis.XAxis.__init__(self, axes, *args, **kwargs)
106+
super().__init__(axes, *args, **kwargs)
107107

108108
# data and viewing intervals for this direction
109109
self.d_interval = d_intervalx
@@ -134,15 +134,15 @@ def init3d(self):
134134
self.offsetText._transform = self.axes.transData
135135

136136
def get_major_ticks(self, numticks=None):
137-
ticks = maxis.XAxis.get_major_ticks(self, numticks)
137+
ticks = super().get_major_ticks(numticks)
138138
for t in ticks:
139139
for obj in [
140140
t.tick1line, t.tick2line, t.gridline, t.label1, t.label2]:
141141
obj.set_transform(self.axes.transData)
142142
return ticks
143143

144144
def get_minor_ticks(self, numticks=None):
145-
ticks = maxis.XAxis.get_minor_ticks(self, numticks)
145+
ticks = super().get_minor_ticks(numticks)
146146
for t in ticks:
147147
for obj in [
148148
t.tick1line, t.tick2line, t.gridline, t.label1, t.label2]:

0 commit comments

Comments
 (0)