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

Skip to content

Commit f2277a5

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

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
@@ -826,48 +826,3 @@ def _init_axis_artists(self):
826826
self._axislines["yzero"] = yaxis_zero
827827

828828
SubplotZero = maxes.subplot_class_factory(AxesZero)
829-
830-
831-
if 0:
832-
#if __name__ == "__main__":
833-
import matplotlib.pyplot as plt
834-
835-
fig = plt.figure(1, (4,3))
836-
837-
ax = SubplotZero(fig, 1, 1, 1)
838-
fig.add_subplot(ax)
839-
840-
ax.axis["xzero"].set_visible(True)
841-
ax.axis["xzero"].label.set_text("Axis Zero")
842-
843-
for n in ["top", "right"]:
844-
ax.axis[n].set_visible(False)
845-
846-
xx = np.arange(0, 2*np.pi, 0.01)
847-
ax.plot(xx, np.sin(xx))
848-
ax.set_ylabel("Test")
849-
plt.draw()
850-
plt.show()
851-
852-
853-
if __name__ == "__main__":
854-
#if 1:
855-
import matplotlib.pyplot as plt
856-
857-
fig = plt.figure(1, (4,3))
858-
859-
ax = Subplot(fig, 1, 1, 1)
860-
fig.add_subplot(ax)
861-
862-
xx = np.arange(0, 2*np.pi, 0.01)
863-
ax.plot(xx, np.sin(xx))
864-
ax.set_ylabel("Test")
865-
866-
ax.axis["top"].major_ticks.set_tick_out(True) #set_tick_direction("out")
867-
ax.axis["bottom"].major_ticks.set_tick_out(True) #set_tick_direction("out")
868-
#ax.axis["bottom"].set_tick_direction("in")
869-
870-
ax.axis["bottom"].set_label("Tk0")
871-
872-
plt.draw()
873-
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')
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')
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)