Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit1afa742

Browse files
committed
Merge pull request#447 from cragm/fillstyle_none
allow fillstyle 'none' option
2 parents6a878de +c40ba26 commit1afa742

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

‎lib/matplotlib/lines.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ def get_fillstyle(self):
306306
defset_fillstyle(self,fs):
307307
"""
308308
Set the marker fill style; 'full' means fill the whole marker.
309-
Theother options are for halffilled 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
defget_marker(self):returnself._marker.get_marker()
573573

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

585586
defget_markeredgewidth(self):returnself._markeredgewidth
586587

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

593-
if (fcisNoneor (is_string_like(fc)andfc.lower()=='none') ):
594-
returnfc
595-
elif (is_string_like(fc)andfc.lower()=='auto'):
596-
returnself._color
594+
if (is_string_like(fc)andfc.lower()=='auto'):
595+
ifself.get_fillstyle()=='none':
596+
return'none'
597+
else:
598+
returnself._color
597599
else:
598600
returnfc
599601

‎lib/matplotlib/markers.py

Lines 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=fsinself._half_fillstyles
251+
returnresult
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-
iffs=='full':
257+
ifnotself._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-
iffs=='full':
299+
ifnotself._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-
iffs=='full':
338+
ifnotself._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-
iffs=='full':
358+
ifnotself._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-
iffs=='full':
383+
ifnotself._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-
iffs=='full':
413+
ifnotself._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-
iffs=='full':
442+
ifnotself._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-
iffs=='full':
474+
ifnotself._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-
iffs=='full':
506+
ifnotself._half_fill():
501507
self._transform.rotate_deg(22.5)
502508
self._path=polypath
503509
else:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp