Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2be931b

Browse files
RezangyalQuLogic
authored andcommitted
Patch now support the "None" linestyle
If patch.linestyle is "none", "None", " ", "" then no edge rendered (as in Line2D).
1 parent ae47ad2 commit 2be931b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/matplotlib/patches.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ def set_linestyle(self, ls):
409409
``'--'`` or ``'dashed'`` dashed line
410410
``'-.'`` or ``'dashdot'`` dash-dotted line
411411
``':'`` or ``'dotted'`` dotted line
412+
``'None'`` draw nothing
413+
``'none'`` draw nothing
414+
``' '`` draw nothing
415+
``''`` draw nothing
412416
=========================== =================
413417
414418
Alternatively a dash tuple of the following form can be provided::
@@ -424,6 +428,8 @@ def set_linestyle(self, ls):
424428
"""
425429
if ls is None:
426430
ls = "solid"
431+
if ls in [' ', '', 'none']:
432+
ls = 'None'
427433
self._linestyle = ls
428434
# get the unscaled dash pattern
429435
offset, ls = self._us_dashes = mlines._get_dash_pattern(ls)
@@ -540,7 +546,7 @@ def _bind_draw_path_function(self, renderer):
540546
gc.set_foreground(self._edgecolor, isRGBA=True)
541547

542548
lw = self._linewidth
543-
if self._edgecolor[3] == 0:
549+
if self._edgecolor[3] == 0 or self._linestyle == 'None':
544550
lw = 0
545551
gc.set_linewidth(lw)
546552
gc.set_dashes(self._dashoffset, self._dashes)

0 commit comments

Comments
 (0)