@@ -102,6 +102,7 @@ class MarkerStyle:
102
102
'o' , 'v' , '^' , '<' , '>' , '8' , 's' , 'p' , '*' , 'h' , 'H' , 'D' , 'd' )
103
103
104
104
fillstyles = ('full' , 'left' , 'right' , 'bottom' , 'top' , 'none' )
105
+ _half_fillstyles = ('left' , 'right' , 'bottom' , 'top' )
105
106
106
107
# TODO: Is this ever used as a non-constant?
107
108
_point_size_reduction = 0.5
@@ -244,11 +245,16 @@ def _set_mathtext_path(self):
244
245
self ._path = text
245
246
self ._snap = False
246
247
248
+ def _half_fill (self ):
249
+ fs = self .get_fillstyle ()
250
+ result = fs in _half_fillstyles
251
+ return result
252
+
247
253
def _set_circle (self , reduction = 1.0 ):
248
254
self ._transform = Affine2D ().scale (0.5 * reduction )
249
255
self ._snap_threshold = 3.0
250
256
fs = self .get_fillstyle ()
251
- if fs == 'full' or fs == 'none' :
257
+ if not _half_fill () :
252
258
self ._path = Path .unit_circle ()
253
259
else :
254
260
# build a right-half circle
@@ -290,7 +296,7 @@ def _set_triangle(self, rot, skip):
290
296
self ._snap_threshold = 5.0
291
297
fs = self .get_fillstyle ()
292
298
293
- if fs == 'full' or fs == 'none' :
299
+ if not _half_fill () :
294
300
self ._path = self ._triangle_path
295
301
else :
296
302
mpaths = [self ._triangle_path_u ,
@@ -329,7 +335,7 @@ def _set_square(self):
329
335
self ._transform = Affine2D ().translate (- 0.5 , - 0.5 )
330
336
self ._snap_threshold = 2.0
331
337
fs = self .get_fillstyle ()
332
- if fs == 'full' or fs == 'none' :
338
+ if not _half_fill () :
333
339
self ._path = Path .unit_rectangle ()
334
340
else :
335
341
# build a bottom filled square out of two rectangles, one
@@ -349,7 +355,7 @@ def _set_diamond(self):
349
355
self ._transform = Affine2D ().translate (- 0.5 , - 0.5 ).rotate_deg (45 )
350
356
self ._snap_threshold = 5.0
351
357
fs = self .get_fillstyle ()
352
- if fs == 'full' or fs == 'none' :
358
+ if not _half_fill () :
353
359
self ._path = Path .unit_rectangle ()
354
360
else :
355
361
self ._path = Path ([[0.0 , 0.0 ], [1.0 , 0.0 ], [1.0 , 1.0 ], [0.0 , 0.0 ]])
@@ -374,7 +380,7 @@ def _set_pentagon(self):
374
380
polypath = Path .unit_regular_polygon (5 )
375
381
fs = self .get_fillstyle ()
376
382
377
- if fs == 'full' or fs == 'none' :
383
+ if not _half_fill () :
378
384
self ._path = polypath
379
385
else :
380
386
verts = polypath .vertices
@@ -404,7 +410,7 @@ def _set_star(self):
404
410
fs = self .get_fillstyle ()
405
411
polypath = Path .unit_regular_star (5 , innerCircle = 0.381966 )
406
412
407
- if fs == 'full' or fs == 'none' :
413
+ if not _half_fill () :
408
414
self ._path = polypath
409
415
else :
410
416
verts = polypath .vertices
@@ -433,7 +439,7 @@ def _set_hexagon1(self):
433
439
fs = self .get_fillstyle ()
434
440
polypath = Path .unit_regular_polygon (6 )
435
441
436
- if fs == 'full' or fs == 'none' :
442
+ if not _half_fill () :
437
443
self ._path = polypath
438
444
else :
439
445
verts = polypath .vertices
@@ -465,7 +471,7 @@ def _set_hexagon2(self):
465
471
fs = self .get_fillstyle ()
466
472
polypath = Path .unit_regular_polygon (6 )
467
473
468
- if fs == 'full' or fs == 'none' :
474
+ if not _half_fill () :
469
475
self ._path = polypath
470
476
else :
471
477
verts = polypath .vertices
@@ -497,7 +503,7 @@ def _set_octagon(self):
497
503
fs = self .get_fillstyle ()
498
504
polypath = Path .unit_regular_polygon (8 )
499
505
500
- if fs == 'full' or fs == 'none' :
506
+ if not _half_fill () :
501
507
self ._transform .rotate_deg (22.5 )
502
508
self ._path = polypath
503
509
else :
0 commit comments