8000 Merge pull request #9383 from dstansby/axes-testing · choldgraf/matplotlib@04fbfa5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04fbfa5

Browse files
authored
Merge pull request matplotlib#9383 from dstansby/axes-testing
Increase axes test coverage
2 parents 3d13126 + 6e511f1 commit 04fbfa5

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed
Loading
Loading
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,46 @@
3535
# the tests with multiple threads.
3636

3737

38+
def test_get_labels():
39+
fig, ax = plt.subplots()
40+
ax.set_xlabel('x label')
41+
ax.set_ylabel('y label')
42+
assert ax.get_xlabel() == 'x label'
43+
assert ax.get_ylabel() == 'y label'
44+
45+
46+
@image_comparison(baseline_images=['acorr'], extensions=['png'], style='mpl20')
47+
def test_acorr():
48+
np.random.seed(19680801)
49+
n = 512
50+
x = np.random.normal(0, 1, n).cumsum()
51+
52+
fig, ax = plt.subplots()
53+
ax.acorr(x, maxlags=n - 1)
54+
55+
56+
@image_comparison(baseline_images=['spy'], extensions=['png'], style='mpl20')
57+
def test_spy():
58+
np.random.seed(19680801)
59+
a = np.ones(32 * 32)
60+
a[:16 * 32] = 0
61+
np.random.shuffle(a)
62+
a = np.reshape(a, (32, 32))
63+
64+
fig, ax = plt.subplots()
65+
ax.spy(a)
66+
67+
68+
@image_comparison(baseline_images=['matshow'],
69+
extensions=['png'], style='mpl20')
70+
def test_matshow():
71+
np.random.seed(19680801)
72+
a = np.random.rand(32, 32)
73+
74+
fig, ax = plt.subplots()
75+
ax.matshow(a)
76+
77+
3878
@image_comparison(baseline_images=['formatter_ticker_001',
3979
'formatter_ticker_002',
4080
'formatter_ticker_003',

0 commit comments

Comments
 (0)
0