Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1afa742

Browse filesBrowse files
committed
Merge pull request #447 from cragm/fillstyle_none
allow fillstyle 'none' option
2 parents 6a878de + c40ba26 commit 1afa742
Copy full SHA for 1afa742

File tree

Expand file treeCollapse file tree

2 files changed

+28
-20
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+28
-20
lines changed

‎lib/matplotlib/lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/lines.py
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ def get_fillstyle(self):
306306
def set_fillstyle(self, fs):
307307
"""
308308
Set the marker fill style; 'full' means fill the whole marker.
309-
The other options are for half filled markers
309+
'none' means no filling; other options are for half-filled markers.
310310
311-
ACCEPTS: ['full' | 'left' | 'right' | 'bottom' | 'top']
311+
ACCEPTS: ['full' | 'left' | 'right' | 'bottom' | 'top' | 'none']
312312
"""
313313
self._marker.set_fillstyle(fs)
314314

@@ -572,15 +572,16 @@ def get_linewidth(self): return self._linewidth
572572
def get_marker(self): return self._marker.get_marker()
573573

574574
def get_markeredgecolor(self):
575-
if (is_string_like(self._markeredgecolor) and
576-
self._markeredgecolor == 'auto'):
575+
mec = self._markeredgecolor
576+
if (is_string_like(mec) and mec == 'auto'):
577577
if self._marker.get_marker() in ('.', ','):
578578
return self._color
579-
if self._marker.is_filled():
579+
if self._marker.is_filled() and self.get_fillstyle() != 'none':
580580
return 'k' # Bad hard-wired default...
581581
else:
582582
return self._color
583-
return self._markeredgecolor
583+
else:
584+
return mec
584585

585586
def get_markeredgewidth(self): return self._markeredgewidth
586587

@@ -590,10 +591,11 @@ def _get_markerfacecolor(self, alt=False):
590591
else:
591592
fc = self._markerfacecolor
592593

593-
if (fc is None or (is_string_like(fc) and fc.lower()=='none') ):
594-
return fc
595-
elif (is_string_like(fc) and fc.lower() == 'auto'):
596-
return self._color
594+
if (is_string_like(fc) and fc.lower() == 'auto'):
595+
if self.get_fillstyle() == 'none':
596+
return 'none'
597+
else:
598+
return self._color
597599
else:
598600
return fc
599601

‎lib/matplotlib/markers.py

Copy file name to clipboardExpand all lines: lib/matplotlib/markers.py
+16-10Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ class MarkerStyle:
101101
filled_markers = (
102102
'o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd')
103103

104-
fillstyles = ('full', 'left' , 'right' , 'bottom' , 'top')
104+
fillstyles = ('full', 'left' , 'right' , 'bottom' , 'top', 'none')
105+
_half_fillstyles = ('left' , 'right' , 'bottom' , 'top')
105106

106107
# TODO: Is this ever used as a non-constant?
107108
_point_size_reduction = 0.5
@@ -244,11 +245,16 @@ def _set_mathtext_path(self):
244245
self._path = text
245246
self._snap = False
246247

248+
def _half_fill(self):
249+
fs = self.get_fillstyle()
250+
result = fs in self._half_fillstyles
251+
return result
252+
247253
def _set_circle(self, reduction = 1.0):
248254
self._transform = Affine2D().scale(0.5 * reduction)
249255
self._snap_threshold = 3.0
250256
fs = self.get_fillstyle()
251-
if fs=='full':
257+
if not self._half_fill():
252258
self._path = Path.unit_circle()
253259
else:
254260
# build a right-half circle
@@ -290,7 +296,7 @@ def _set_triangle(self, rot, skip):
290296
self._snap_threshold = 5.0
291297
fs = self.get_fillstyle()
292298

293-
if fs=='full':
299+
if not self._half_fill():
294300
self._path = self._triangle_path
295301
else:
296302
mpaths = [self._triangle_path_u,
@@ -329,7 +335,7 @@ def _set_square(self):
329335
self._transform = Affine2D().translate(-0.5, -0.5)
330336
self._snap_threshold = 2.0
331337
fs = self.get_fillstyle()
332-
if fs=='full':
338+
if not self._half_fill():
333339
self._path = Path.unit_rectangle()
334340
else:
335341
# build a bottom filled square out of two rectangles, one
@@ -349,7 +355,7 @@ def _set_diamond(self):
349355
self._transform = Affine2D().translate(-0.5, -0.5).rotate_deg(45)
350356
self._snap_threshold = 5.0
351357
fs = self.get_fillstyle()
352-
if fs=='full':
358+
if not self._half_fill():
353359
self._path = Path.unit_rectangle()
354360
else:
355361
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):
374380
polypath = Path.unit_regular_polygon(5)
375381
fs = self.get_fillstyle()
376382

377-
if fs == 'full':
383+
if not self._half_fill():
378384
self._path = polypath
379385
else:
380386
verts = polypath.vertices
@@ -404,7 +410,7 @@ def _set_star(self):
404410
fs = self.get_fillstyle()
405411
polypath = Path.unit_regular_star(5, innerCircle=0.381966)
406412

407-
if fs == 'full':
413+
if not self._half_fill():
408414
self._path = polypath
409415
else:
410416
verts = polypath.vertices
@@ -433,7 +439,7 @@ def _set_hexagon1(self):
433439
fs = self.get_fillstyle()
434440
polypath = Path.unit_regular_polygon(6)
435441

436-
if fs == 'full':
442+
if not self._half_fill():
437443
self._path = polypath
438444
else:
439445
verts = polypath.vertices
@@ -465,7 +471,7 @@ def _set_hexagon2(self):
465471
fs = self.get_fillstyle()
466472
polypath = Path.unit_regular_polygon(6)
467473

468-
if fs == 'full':
474+
if not self._half_fill():
469475
self._path = polypath
470476
else:
471477
verts = polypath.vertices
@@ -497,7 +503,7 @@ def _set_octagon(self):
497503
fs = self.get_fillstyle()
498504
polypath = Path.unit_regular_polygon(8)
499505

500-
if fs == 'full':
506+
if not self._half_fill():
501507
self._transform.rotate_deg(22.5)
502508
self._path = polypath
503509
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.