Skip to content

Commit 1f0e8f7

Browse files
adds cleanfigure semilogplot test
1 parent 5f20f25 commit 1f0e8f7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/test_cleanfigure.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,25 @@ def test_logplot(self):
5353
assert numLinesRaw - numLinesClean == 11
5454
plt.close("all")
5555

56+
def test_semilogplot(self):
57+
x = np.logspace(-3, 3, 20)
58+
y = np.linspace(1, 100, 20)
59+
60+
with plt.rc_context(rc=RC_PARAMS):
61+
fig, ax = plt.subplots(1, 1, figsize=(5, 5))
62+
ax.plot(x, y)
63+
ax.set_xscale("log")
64+
ax.set_xlim([10 ** (-2), 10 ** (2)])
65+
ax.set_ylim([20, 80])
66+
raw = get_tikz_code()
67+
68+
clean_figure(fig)
69+
clean = get_tikz_code()
70+
numLinesRaw = raw.count("\n")
71+
numLinesClean = clean.count("\n")
72+
assert numLinesRaw - numLinesClean == 6
73+
plt.close("all")
74+
5675
def test_step(self):
5776
x = np.linspace(1, 100, 20)
5877
y = np.linspace(1, 100, 20)

0 commit comments

Comments
 (0)