Skip to content

Commit c15a2b8

Browse files
authored
Merge pull request #12268 from kmuehlbauer/fix-12265
FIX: remove unnecessary `self` in `super_`-calls, fixes #12265
2 parents b7824b1 + 893738d commit c15a2b8

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

lib/mpl_toolkits/axes_grid1/parasite_axes.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ def _pcolor(self, super_pcolor, *XYC, **kwargs):
104104
X, Y, C = XYC
105105

106106
if "transform" in kwargs:
107-
mesh = super_pcolor(self, X, Y, C, **kwargs)
107+
mesh = super_pcolor(X, Y, C, **kwargs)
108108
else:
109109
orig_shape = X.shape
110110
xyt = np.column_stack([X.flat, Y.flat])
111111
wxy = self.transAux.transform(xyt)
112112
gx = wxy[:, 0].reshape(orig_shape)
113113
gy = wxy[:, 1].reshape(orig_shape)
114-
mesh = super_pcolor(self, gx, gy, C, **kwargs)
114+
mesh = super_pcolor(gx, gy, C, **kwargs)
115115
mesh.set_transform(self._parent_axes.transData)
116116

117117
return mesh
@@ -138,14 +138,14 @@ def _contour(self, super_contour, *XYCL, **kwargs):
138138
CL = XYCL[2:]
139139

140140
if "transform" in kwargs:
141-
cont = super_contour(self, X, Y, *CL, **kwargs)
141+
cont = super_contour(X, Y, *CL, **kwargs)
142142
else:
143143
orig_shape = X.shape
144144
xyt = np.column_stack([X.flat, Y.flat])
145145
wxy = self.transAux.transform(xyt)
146146
gx = wxy[:, 0].reshape(orig_shape)
147147
gy = wxy[:, 1].reshape(orig_shape)
148-
cont = super_contour(self, gx, gy, *CL, **kwargs)
148+
cont = super_contour(gx, gy, *CL, **kwargs)
149149
for c in cont.collections:
150150
c.set_transform(self._parent_axes.transData)
151151

lib/mpl_toolkits/tests/test_axisartist_axislines.py

+34
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import numpy as np
22
import matplotlib.pyplot as plt
33
from matplotlib.testing.decorators import image_comparison
4+
from matplotlib.transforms import IdentityTransform
45

56
from mpl_toolkits.axisartist.axislines import SubplotZero, Subplot
7+
from mpl_toolkits.axisartist import SubplotHost, ParasiteAxesAuxTrans
68

79
from mpl_toolkits.axisartist import Axes
810

@@ -53,3 +55,35 @@ def test_Axes():
5355
ax.set_xscale('log')
5456

5557
plt.show()
58+
59+
60+
@image_comparison(baseline_images=['ParasiteAxesAuxTrans_meshplot'],
61+
extensions=['png'], remove_text=True, style='default',
62+
tol=0.075)
63+
def test_ParasiteAxesAuxTrans():
64+
65+
data = np.ones((6, 6))
66+
data[2, 2] = 2
67+
data[0, :] = 0
68+
data[-2, :] = 0
69+
data[:, 0] = 0
70+
data[:, -2] = 0
71+
x = np.arange(6)
72+
y = np.arange(6)
73+
xx, yy = np.meshgrid(x, y)
74+
75+
funcnames = ['pcolor', 'pcolormesh', 'contourf']
76+
77+
fig = plt.figure()
78+
for i, name in enumerate(funcnames):
79+
80+
ax1 = SubplotHost(fig, 1, 3, i+1)
81+
fig.add_subplot(ax1)
82+
83+
ax2 = ParasiteAxesAuxTrans(ax1, IdentityTransform())
84+
ax1.parasites.append(ax2)
85+
getattr(ax2, name)(xx, yy, data)
86+
ax1.set_xlim((0, 5))
87+
ax1.set_ylim((0, 5))
88+
89+
ax2.contour(xx, yy, data, colors='k')

0 commit comments

Comments
 (0)