@@ -24,8 +24,9 @@ class MarkerStyle:
2424marker description
2525============================== ===============================================
2626%s
27- ``'$...$'`` render the string using mathtext
28- *verts* a list of (x, y) pairs in range (0, 1)
27+ ``'$...$'`` render the string using mathtext.
28+ *verts* a list of (x, y) pairs used for Path vertices.
29+ path a :class:`~matplotlib.path.Path` instance.
2930(*numsides*, *style*, *angle*) see below
3031============================== ===============================================
3132
@@ -151,6 +152,8 @@ def set_marker(self, marker):
151152 if (iterable (marker ) and len (marker ) in (2 , 3 ) and
152153 marker [1 ] in (0 , 1 , 2 , 3 )):
153154 self ._marker_function = self ._set_tuple_marker
155+ elif isinstance (marker , np .ndarray ):
156+ self ._marker_function = self ._set_vertices
154157 elif marker in self .markers :
155158 self ._marker_function = getattr (
156159 self , '_set_' + self .markers [marker ])
@@ -160,10 +163,10 @@ def set_marker(self, marker):
160163 self ._marker_function = self ._set_path_marker
161164 else :
162165 try :
163- path = Path (marker )
166+ _ = Path (marker )
164167 self ._marker_function = self ._set_vertices
165- except :
166- raise ValueError ('Unrecognized marker style %s' % marker )
168+ except ValueError :
169+ raise ValueError ('Unrecognized marker style {}' . format ( marker ) )
167170
168171 self ._marker = marker
169172 self ._recache ()
@@ -196,8 +199,9 @@ def _set_path_marker(self):
196199 self ._set_custom_marker (self ._marker )
197200
198201 def _set_vertices (self ):
199- path = Path (verts )
200- self ._set_custom_marker (path )
202+ verts = self ._marker
203+ marker = Path (verts )
204+ self ._set_custom_marker (marker )
201205
202206 def _set_tuple_marker (self ):
203207 marker = self ._marker
@@ -231,7 +235,6 @@ def _set_mathtext_path(self):
231235
232236 Submitted by tcb
233237 """
234- from matplotlib .patches import PathPatch
235238 from matplotlib .text import TextPath
236239 from matplotlib .font_manager import FontProperties
237240
@@ -443,10 +446,10 @@ def _set_star(self):
443446 else :
444447 verts = polypath .vertices
445448
446- top = Path (np .vstack ((verts [0 :4 ,:], verts [7 :10 ,:], verts [0 ])))
447- bottom = Path (np .vstack ((verts [3 :8 ,:], verts [3 ])))
448- left = Path (np .vstack ((verts [0 :6 ,:], verts [0 ])))
449- right = Path (np .vstack ((verts [0 ], verts [5 :10 ,:], verts [0 ])))
449+ top = Path (np .vstack ((verts [0 :4 , :], verts [7 :10 , :], verts [0 ])))
450+ bottom = Path (np .vstack ((verts [3 :8 , :], verts [3 ])))
451+ left = Path (np .vstack ((verts [0 :6 , :], verts [0 ])))
452+ right = Path (np .vstack ((verts [0 ], verts [5 :10 , :], verts [0 ])))
450453
451454 if fs == 'top' :
452455 mpath , mpath_alt = top , bottom
@@ -476,10 +479,10 @@ def _set_hexagon1(self):
476479
477480 # not drawing inside lines
478481 x = np .abs (np .cos (5 * np .pi / 6. ))
479- top = Path (np .vstack (([- x ,0 ],verts [(1 ,0 , 5 ),:],[x ,0 ])))
480- bottom = Path (np .vstack (([- x ,0 ],verts [2 :5 ,:],[x ,0 ])))
481- left = Path (verts [(0 ,1 , 2 , 3 ),:])
482- right = Path (verts [(0 ,5 , 4 , 3 ),:])
482+ top = Path (np .vstack (([- x , 0 ], verts [(1 , 0 , 5 ), :], [x , 0 ])))
483+ bottom = Path (np .vstack (([- x , 0 ], verts [2 :5 , :], [x , 0 ])))
484+ left = Path (verts [(0 , 1 , 2 , 3 ), :])
485+ right = Path (verts [(0 , 5 , 4 , 3 ), :])
483486
484487 if fs == 'top' :
485488 mpath , mpath_alt = top , bottom
@@ -510,10 +513,10 @@ def _set_hexagon2(self):
510513
511514 # not drawing inside lines
512515 x , y = np .sqrt (3 )/ 4 , 3 / 4.
513- top = Path (verts [(1 ,0 , 5 , 4 , 1 ),:])
514- bottom = Path (verts [(1 ,2 , 3 , 4 ),:])
515- left = Path (np .vstack (([x ,y ],verts [(0 ,1 , 2 ),:],[- x ,- y ],[x ,y ])))
516- right = Path (np .vstack (([x ,y ],verts [(5 ,4 , 3 ),:],[- x ,- y ])))
516+ top = Path (verts [(1 , 0 , 5 , 4 , 1 ), :])
517+ bottom = Path (verts [(1 , 2 , 3 , 4 ), :])
518+ left = Path (np .vstack (([x , y ], verts [(0 , 1 , 2 ), :], [- x , - y ], [x , y ])))
519+ right = Path (np .vstack (([x , y ], verts [(5 , 4 , 3 ), :], [- x , - y ])))
517520
518521 if fs == 'top' :
519522 mpath , mpath_alt = top , bottom
0 commit comments