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

Skip to content

Commit 244812e

Browse files
committed
Fix PatchCollection bug 2732455 by letting to_rgba handle 'none'
svn path=/branches/v0_98_5_maint/; revision=7025
1 parent eabbb36 commit 244812e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/matplotlib/colors.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,17 @@ def to_rgba(self, arg, alpha=None):
318318
Returns an *RGBA* tuple of four floats from 0-1.
319319
320320
For acceptable values of *arg*, see :meth:`to_rgb`.
321+
In addition, if *arg* is "none" (case-insensitive),
322+
then (0,0,0,0) will be returned.
321323
If *arg* is an *RGBA* sequence and *alpha* is not *None*,
322324
*alpha* will replace the original *A*.
323325
"""
326+
try:
327+
if arg.lower() == 'none':
328+
return (0.0, 0.0, 0.0, 0.0)
329+
except AttributeError:
330+
pass
331+
324332
try:
325333
if not cbook.is_string_like(arg) and cbook.iterable(arg):
326334
if len(arg) == 4:

0 commit comments

Comments
 (0)