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

Skip to content

Commit 3853805

Browse files
committed
Make axisartist.axislines pseudo-tests real.
The results seem to be acceptable.
1 parent 181042e commit 3853805

File tree

4 files changed

+45
-45
lines changed

4 files changed

+45
-45
lines changed

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -847,48 +847,3 @@ def _init_axis_artists(self):
847847
self._axislines["yzero"] = yaxis_zero
848848

849849
SubplotZero = maxes.subplot_class_factory(AxesZero)
850-
851-
852-
if 0:
853-
#if __name__ == "__main__":
854-
import matplotlib.pyplot as plt
855-
856-
fig = plt.figure(1, (4,3))
857-
858-
ax = SubplotZero(fig, 1, 1, 1)
859-
fig.add_subplot(ax)
860-
861-
ax.axis["xzero"].set_visible(True)
862-
ax.axis["xzero"].label.set_text("Axis Zero")
863-
864-
for n in ["top", "right"]:
865-
ax.axis[n].set_visible(False)
866-
867-
xx = np.arange(0, 2*np.pi, 0.01)
868-
ax.plot(xx, np.sin(xx))
869-
ax.set_ylabel("Test")
870-
plt.draw()
871-
plt.show()
872-
873-
874-
if __name__ == "__main__":
875-
#if 1:
876-
import matplotlib.pyplot as plt
877-
878-
fig = plt.figure(1, (4,3))
879-
880-
ax = Subplot(fig, 1, 1, 1)
881-
fig.add_subplot(ax)
882-
883-
xx = np.arange(0, 2*np.pi, 0.01)
884-
ax.plot(xx, np.sin(xx))
885-
ax.set_ylabel("Test")
886-
887-
ax.axis["top"].major_ticks.set_tick_out(True) #set_tick_direction("out")
888-
ax.axis["bottom"].major_ticks.set_tick_out(True) #set_tick_direction("out")
889-
#ax.axis["bottom"].set_tick_direction("in")
890-
891-
ax.axis["bottom"].set_label("Tk0")
892-
893-
plt.draw()
894-
plt.show()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from __future__ import (absolute_import, division, print_function,
2+
unicode_literals)
3+
4+
import numpy as np
5+
import matplotlib.pyplot as plt
6+
from matplotlib.testing.decorators import image_comparison
7+
8+
from mpl_toolkits.axisartist.axislines import SubplotZero, Subplot
9+
10+
11+
@image_comparison(baseline_images=['SubplotZero'],
12+
extensions=['png'], style='default', tol=0.01)
13+
def test_SubplotZero():
14+
fig = plt.figure()
15+
16+
ax = SubplotZero(fig, 1, 1, 1)
17+
fig.add_subplot(ax)
18+
19+
ax.axis["xzero"].set_visible(True)
20+
ax.axis["xzero"].label.set_text("Axis Zero")
21+
22+
for n in ["top", "right"]:
23+
ax.axis[n].set_visible(False)
24+
25+
xx = np.arange(0, 2 * np.pi, 0.01)
26+
ax.plot(xx, np.sin(xx))
27+
ax.set_ylabel("Test")
28+
29+
30+
@image_comparison(baseline_images=['Subplot'],
31+
extensions=['png'], style='default', tol=0.01)
32+
def test_Subplot():
33+
fig = plt.figure()
34+
35+
ax = Subplot(fig, 1, 1, 1)
36+
fig.add_subplot(ax)
37+
38+
xx = np.arange(0, 2 * np.pi, 0.01)
39+
ax.plot(xx, np.sin(xx))
40+
ax.set_ylabel("Test")
41+
42+
ax.axis["top"].major_ticks.set_tick_out(True)
43+
ax.axis["bottom"].major_ticks.set_tick_out(True)
44+
45+
ax.axis["bottom"].set_label("Tk0")

0 commit comments

Comments
 (0)