Skip to content

Commit f5b7f5b

Browse files
committed
ENH: add image comparison tests for ParasiteAxesAuxTrans pcolor, pcolormesh and contourf/contour
1 parent f11a881 commit f5b7f5b

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

lib/mpl_toolkits/tests/test_axisartist_axislines.py

Lines changed: 34 additions & 0 deletions
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.05)
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)