Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/mpl_toolkits/axes_grid1/parasite_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ def _pcolor(self, super_pcolor, *XYC, **kwargs):
X, Y, C = XYC

if "transform" in kwargs:
mesh = super_pcolor(self, X, Y, C, **kwargs)
mesh = super_pcolor(X, Y, C, **kwargs)
else:
orig_shape = X.shape
xyt = np.column_stack([X.flat, Y.flat])
wxy = self.transAux.transform(xyt)
gx = wxy[:, 0].reshape(orig_shape)
gy = wxy[:, 1].reshape(orig_shape)
mesh = super_pcolor(self, gx, gy, C, **kwargs)
mesh = super_pcolor(gx, gy, C, **kwargs)
mesh.set_transform(self._parent_axes.transData)

return mesh
Expand All @@ -140,14 +140,14 @@ def _contour(self, super_contour, *XYCL, **kwargs):
CL = XYCL[2:]

if "transform" in kwargs:
cont = super_contour(self, X, Y, *CL, **kwargs)
cont = super_contour(X, Y, *CL, **kwargs)
else:
orig_shape = X.shape
xyt = np.column_stack([X.flat, Y.flat])
wxy = self.transAux.transform(xyt)
gx = wxy[:, 0].reshape(orig_shape)
gy = wxy[:, 1].reshape(orig_shape)
cont = super_contour(self, gx, gy, *CL, **kwargs)
cont = super_contour(gx, gy, *CL, **kwargs)
for c in cont.collections:
c.set_transform(self._parent_axes.transData)

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions lib/mpl_toolkits/tests/test_axisartist_axislines.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.testing.decorators import image_comparison
from matplotlib.transforms import IdentityTransform

from mpl_toolkits.axisartist.axislines import SubplotZero, Subplot
from mpl_toolkits.axisartist import SubplotHost, ParasiteAxesAuxTrans

from mpl_toolkits.axisartist import Axes

Expand Down Expand Up @@ -53,3 +55,35 @@ def test_Axes():
ax.set_xscale('log')

plt.show()


@image_comparison(baseline_images=['ParasiteAxesAuxTrans_meshplot'],
extensions=['png'], remove_text=True, style='default',
tol=0.075)
def test_ParasiteAxesAuxTrans():

data = np.ones((6, 6))
data[2, 2] = 2
data[0, :] = 0
data[-2, :] = 0
data[:, 0] = 0
data[:, -2] = 0
x = np.arange(6)
y = np.arange(6)
xx, yy = np.meshgrid(x, y)

funcnames = ['pcolor', 'pcolormesh', 'contourf']

fig = plt.figure()
for i, name in enumerate(funcnames):

ax1 = SubplotHost(fig, 1, 3, i+1)
fig.add_subplot(ax1)

ax2 = ParasiteAxesAuxTrans(ax1, IdentityTransform())
ax1.parasites.append(ax2)
getattr(ax2, name)(xx, yy, data)
ax1.set_xlim((0, 5))
ax1.set_ylim((0, 5))

ax2.contour(xx, yy, data, colors='k')