23
23
"This test needs a TeX installation" )
24
24
25
25
26
- def _test_savefig_to_stringio (format = 'ps' ):
26
+ def _test_savefig_to_stringio (format = 'ps' , use_log = False ):
27
27
buffers = [
28
28
six .moves .StringIO (),
29
29
io .StringIO (),
30
30
io .BytesIO ()]
31
31
32
32
plt .figure ()
33
- plt .plot ([0 , 1 ], [0 , 1 ])
33
+
34
+ if use_log :
35
+ plt .yscale ('log' )
36
+
37
+ plt .plot ([1 , 2 ], [1 , 2 ])
34
38
plt .title ("Déjà vu" )
35
39
for buffer in buffers :
36
40
plt .savefig (buffer , format = format )
@@ -78,6 +82,12 @@ def test_savefig_to_stringio_eps():
78
82
_test_savefig_to_stringio (format = 'eps' )
79
83
80
84
85
+ @cleanup
86
+ def test_savefig_to_stringio_eps_afm ():
87
+ matplotlib .rcParams ['ps.useafm' ] = True
88
+ _test_savefig_to_stringio (format = 'eps' , use_log = True )
89
+
90
+
81
91
@cleanup
82
92
@needs_tex
83
93
def test_savefig_to_stringio_with_usetex_eps ():
@@ -88,8 +98,8 @@ def test_savefig_to_stringio_with_usetex_eps():
88
98
89
99
@cleanup
90
100
def test_composite_image ():
91
- #Test that figures can be saved with and without combining multiple images
92
- #(on a single set of axes) into a single composite image.
101
+ # Test that figures can be saved with and without combining multiple images
102
+ # (on a single set of axes) into a single composite image.
93
103
X , Y = np .meshgrid (np .arange (- 5 , 5 , 1 ), np .arange (- 5 , 5 , 1 ))
94
104
Z = np .sin (Y ** 2 )
95
105
fig = plt .figure ()
@@ -110,6 +120,7 @@ def test_composite_image():
110
120
buff = ps .read ()
111
121
assert buff .count (six .b (' colorimage' )) == 2
112
122
123
+
113
124
if __name__ == '__main__' :
114
125
import nose
115
126
nose .runmodule (argv = ['-s' , '--with-doctest' ], exit = False )
0 commit comments