55 unicode_literals )
66
77from matplotlib .externals import six
8-
8+ import itertools
9+ import matplotlib .lines as mlines
910import nose
1011from nose .tools import assert_true , assert_raises
1112from timeit import repeat
1213import numpy as np
13- import matplotlib as mpl
14+
1415import matplotlib .pyplot as plt
1516from matplotlib .testing .decorators import cleanup , image_comparison
1617import sys
@@ -38,7 +39,7 @@ def test_invisible_Line_rendering():
3839 ax = plt .subplot (111 )
3940
4041 # Create a "big" Line instance:
41- l = mpl . lines .Line2D (x ,y )
42+ l = mlines .Line2D (x ,y )
4243 l .set_visible (False )
4344 # but don't add it to the Axis instance `ax`
4445
@@ -112,7 +113,7 @@ def test_valid_linestyles():
112113 raise nose .SkipTest ("assert_raises as context manager "
113114 "not supported with Python < 2.7" )
114115
115- line = mpl . lines .Line2D ([], [])
116+ line = mlines .Line2D ([], [])
116117 with assert_raises (ValueError ):
117118 line .set_linestyle ('aardvark' )
118119
@@ -126,9 +127,37 @@ def test_set_line_coll_dash_image():
126127 cs = ax .contour (np .random .randn (20 , 30 ), linestyles = [(0 , (3 , 3 ))])
127128
128129
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+
129158def test_nan_is_sorted ():
130159 # Exercises issue from PR #2744 (NaN throwing warning in _is_sorted)
131- line = mpl . lines .Line2D ([],[])
160+ line = mlines .Line2D ([],[])
132161 assert_true (line ._is_sorted (np .array ([1 ,2 ,3 ])))
133162 assert_true (not line ._is_sorted (np .array ([1 ,np .nan ,3 ])))
134163
0 commit comments