Skip to content

Commit 97f81f9

Browse files
adds logplot test
1 parent adcf150 commit 97f81f9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/test_cleanfigure.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@ def test_plot(self):
3333
assert numLinesRaw - numLinesClean == 18
3434
plt.close("all")
3535

36+
def test_logplot(self):
37+
x = np.logspace(-3, 3, 20)
38+
y = np.logspace(-3, 3, 20)
39+
40+
with plt.rc_context(rc=RC_PARAMS):
41+
fig, ax = plt.subplots(1, 1, figsize=(5, 5))
42+
ax.plot(x, y)
43+
ax.set_xscale("log")
44+
ax.set_yscale("log")
45+
ax.set_ylim([10 ** (-2), 10 ** (2)])
46+
ax.set_xlim([10 ** (-2), 10 ** (2)])
47+
raw = get_tikz_code()
48+
49+
clean_figure(fig)
50+
clean = get_tikz_code()
51+
numLinesRaw = raw.count("\n")
52+
numLinesClean = clean.count("\n")
53+
assert numLinesRaw - numLinesClean == 11
54+
plt.close("all")
55+
3656
def test_step(self):
3757
x = np.linspace(1, 100, 20)
3858
y = np.linspace(1, 100, 20)

0 commit comments

Comments
 (0)