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

Skip to content

Commit ee7a854

Browse files
committed
fix an issue when *c* == 'none'
1 parent e3cea18 commit ee7a854

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3930,7 +3930,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39303930

39313931
# Convenience vars to track shape mismatch *and* conversion failures.
39323932
valid_shape = True # will be put to the test!
3933-
n_elem = 0 # used only for (some) exceptions
3933+
n_elem = -1 # used only for (some) exceptions
39343934

39353935
if c_none or co is not None:
39363936
c_array = None
@@ -3960,8 +3960,9 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39603960
try: # Then is 'c' acceptable as PathCollection facecolors?
39613961
colors = mcolors.to_rgba_array(c)
39623962
n_elem = colors.shape[0]
3963-
if colors.shape[0] not in (1, x.size, y.size):
3963+
if colors.shape[0] not in (0, 1, x.size, y.size):
39643964
# NB: remember that a single color is also acceptable.
3965+
# Besides *colors* will be an empty array if c == 'none'.
39653966
valid_shape = False
39663967
raise ValueError
39673968
except ValueError:

0 commit comments

Comments
 (0)