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

Skip to content

Commit 49e7156

Browse files
committed
Scatter color ValueError now reports size; More efficient color validation
1 parent 65e6a64 commit 49e7156

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3985,14 +3985,14 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39853985
c_array = None
39863986

39873987
if c_array is None:
3988-
colors = c # must be acceptable as PathCollection facecolors
39893988
try:
3990-
mcolors.to_rgba_array(colors)
3989+
# must be acceptable as PathCollection facecolors
3990+
colors = mcolors.to_rgba_array(c)
39913991
except ValueError:
39923992
# c not acceptable as PathCollection facecolor
39933993
msg = ("c of shape {0} not acceptable as a color sequence "
3994-
"for x with shape {1}, y with shape {2}")
3995-
raise ValueError(msg.format(c.shape, x.shape, y.shape))
3994+
"for x with size {1}, y with size {2}")
3995+
raise ValueError(msg.format(c.shape, x.size, y.size))
39963996
else:
39973997
colors = None # use cmap, norm after collection is created
39983998

0 commit comments

Comments
 (0)