5
5
unicode_literals )
6
6
7
7
from matplotlib .externals import six
8
-
8
+ import itertools
9
+ import matplotlib .lines as mlines
9
10
import nose
10
11
from nose .tools import assert_true , assert_raises
11
12
from timeit import repeat
12
13
import numpy as np
13
- import matplotlib as mpl
14
+
14
15
import matplotlib .pyplot as plt
15
16
from matplotlib .testing .decorators import cleanup , image_comparison
16
17
import sys
@@ -38,7 +39,7 @@ def test_invisible_Line_rendering():
38
39
ax = plt .subplot (111 )
39
40
40
41
# Create a "big" Line instance:
41
- l = mpl . lines .Line2D (x ,y )
42
+ l = mlines .Line2D (x ,y )
42
43
l .set_visible (False )
43
44
# but don't add it to the Axis instance `ax`
44
45
@@ -112,7 +113,7 @@ def test_valid_linestyles():
112
113
raise nose .SkipTest ("assert_raises as context manager "
113
114
"not supported with Python < 2.7" )
114
115
115
- line = mpl . lines .Line2D ([], [])
116
+ line = mlines .Line2D ([], [])
116
117
with assert_raises (ValueError ):
117
118
line .set_linestyle ('aardvark' )
118
119
@@ -126,9 +127,37 @@ def test_set_line_coll_dash_image():
126
127
cs = ax .contour (np .random .randn (20 , 30 ), linestyles = [(0 , (3 , 3 ))])
127
128
128
129
130
+ @image_comparison (baseline_images = ['marker_fill_styles' ], remove_text = True ,
131
+ extensions = ['png' ])
132
+ def test_marker_fill_styles ():
133
+ colors = itertools .cycle (['b' , 'g' , 'r' , 'c' , 'm' , 'y' , 'k' ])
134
+ altcolor = 'lightgreen'
135
+
136
+ y = np .array ([1 , 1 ])
137
+ x = np .array ([0 , 9 ])
138
+ fig , ax = plt .subplots ()
139
+
140
+ for j , marker in enumerate (mlines .Line2D .filled_markers ):
141
+ for i , fs in enumerate (mlines .Line2D .fillStyles ):
142
+ color = next (colors )
143
+ ax .plot (j * 10 + x , y + i + .5 * (j % 2 ),
144
+ marker = marker ,
145
+ markersize = 20 ,
146
+ markerfacecoloralt = altcolor ,
147
+ fillstyle = fs ,
148
+ label = fs ,
149
+ linewidth = 5 ,
150
+ color = color ,
151
+ markeredgecolor = color ,
152
+ markeredgewidth = 2 )
153
+
154
+ ax .set_ylim ([0 , 7.5 ])
155
+ ax .set_xlim ([- 5 , 135 ])
156
+
157
+
129
158
def test_nan_is_sorted ():
130
159
# Exercises issue from PR #2744 (NaN throwing warning in _is_sorted)
131
- line = mpl . lines .Line2D ([],[])
160
+ line = mlines .Line2D ([],[])
132
161
assert_true (line ._is_sorted (np .array ([1 ,2 ,3 ])))
133
162
assert_true (not line ._is_sorted (np .array ([1 ,np .nan ,3 ])))
134
163
0 commit comments