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

Skip to content

Commit 2ce3b61

Browse files
authored
Merge pull request #7548 from anntzer/clarify-to_rgba-docstring
DOC: Clarify to_rgba docstring.
2 parents 6223155 + 6d0ee3f commit 2ce3b61

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/colors.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def is_color_like(c):
120120
def to_rgba(c, alpha=None):
121121
"""Convert `c` to an RGBA color.
122122
123-
If `alpha` is not `None`, it forces the alpha value.
123+
If `alpha` is not `None`, it forces the alpha value, except if `c` is
124+
"none" (case-insensitive), which always maps to `(0, 0, 0, 0)`.
124125
"""
125126
# Special-case nth color syntax because it should not be cached.
126127
if _is_nth_color(c):
@@ -142,7 +143,8 @@ def to_rgba(c, alpha=None):
142143
def _to_rgba_no_colorcycle(c, alpha=None):
143144
"""Convert `c` to an RGBA color, with no support for color-cycle syntax.
144145
145-
If `alpha` is not `None`, it forces the alpha value.
146+
If `alpha` is not `None`, it forces the alpha value, except if `c` is
147+
"none" (case-insensitive), which always maps to `(0, 0, 0, 0)`.
146148
"""
147149
orig_c = c
148150
if isinstance(c, six.string_types):

0 commit comments

Comments
 (0)