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

Skip to content

Commit a863457

Browse files
committed
do case insensitive color string matching, as suggested in sf bug 2834598
svn path=/branches/v0_99_maint/; revision=7476
1 parent feaca46 commit a863457

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/matplotlib/colors.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,14 @@ def to_rgb(self, arg):
282282

283283
try:
284284
if cbook.is_string_like(arg):
285-
color = self.colors.get(arg, None)
285+
argl = arg.lower()
286+
color = self.colors.get(argl, None)
286287
if color is None:
287-
str1 = cnames.get(arg, arg)
288+
str1 = cnames.get(argl, argl)
288289
if str1.startswith('#'):
289290
color = hex2color(str1)
290291
else:
291-
fl = float(arg)
292+
fl = float(argl)
292293
if fl < 0 or fl > 1:
293294
raise ValueError(
294295
'gray (string) must be in range 0-1')

0 commit comments

Comments
 (0)