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

Skip to content

Commit 0c170c3

Browse files
committed
ENH: add image comparison tests for ParasiteAxesAuxTrans pcolor, pcolormesh and contourf/contour
1 parent 703219a commit 0c170c3

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

810
@image_comparison(baseline_images=['SubplotZero'],
@@ -40,3 +42,35 @@ def test_Subplot():
4042
ax.axis["bottom"].major_ticks.set_tick_out(True)
4143

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

0 commit comments

Comments
 (0)