8000 FIX: add image comparison tests for ParasiteAxesAuxTrans pcolor/pcolo… · matplotlib/matplotlib@f36cb53 · GitHub
[go: up one dir, main page]

Skip to content

Commit f36cb53

Browse files
committed
FIX: add image comparison tests for ParasiteAxesAuxTrans pcolor/pcolormesh/contour/contourf
1 parent 703219a commit f36cb53

File tree

5 files changed

+35
-1
lines changed

5 files changed

+35
-1
lines changed

lib/mpl_toolkits/tests/test_axisartist_axislines.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +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
6-
7+
from mpl_toolkits.axisartist import SubplotHost, ParasiteAxesAuxTrans
78

89
@image_comparison(baseline_images=['SubplotZero'],
910
extensions=['png'], style='default')
@@ -40,3 +41,36 @@ def test_Subplot():
4041
ax.axis["bottom"].major_ticks.set_tick_out(True)
4142

4243
ax.axis["bottom"].set_label("Tk0")
44+
45+
46+
@image_comparison(baseline_images=['ParasiteAxesAuxTrans_pcolor',
47+
'ParasiteAxesAuxTrans_pcolormesh',
48+
'ParasiteAxesAuxTrans_contour',
49+
'ParasiteAxesAuxTrans_contourf'],
50+
extensions=['png'])
51+
def test_ParasiteAxesAuxTrans():
52+
53+
data = np.ones((6, 6))
54+
data[2, 2] = 2
55+
data[0, :] = 0
56+
data[-2, :] = 0
57+
data[:, 0] = 0
58+
data[:, -2] = 0
59+
x = np.arange(6)
60+
y = np.arange(6)
61+
xx, yy = np.meshgrid(x, y)
62+
63+
funcnames = ['pcolor', 'pcolormesh', 'contour', 'contourf']
64+
65+
for name in funcnames:
66+
fig = plt.figure()
67+
68+
ax1 = SubplotHost(fig, 1, 1, 1)
69+
fig.add_subplot(ax1)
70+
71+
ax2 = ParasiteAxesAuxTrans(ax1, IdentityTransform())
72+
ax1.parasites.append(ax2)
73+
74+
getattr(ax2, name)(xx, yy, data)
75+
ax1.set_xlim((0, 5))
76+
ax1.set_ylim((0, 5))

0 commit comments

Comments
 (0)
0