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

Skip to content

Commit 290c9c0

Browse files
committed
More consistent naming: n_elem -> csize
1 parent 198b3f1 commit 290c9c0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4226,7 +4226,7 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
42264226
# favor of mapping, not rgb or rgba.
42274227
# Convenience vars to track shape mismatch *and* conversion failures.
42284228
valid_shape = True # will be put to the test!
4229-
n_elem = -1 # used only for (some) exceptions
4229+
csize = -1 # Number of colors; used for some exceptions.
42304230

42314231
if (c_was_none or
42324232
kwcolor is not None or
@@ -4238,8 +4238,8 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
42384238
else:
42394239
try: # First, does 'c' look suitable for value-mapping?
42404240
c_array = np.asanyarray(c, dtype=float)
4241-
n_elem = c_array.size
4242-
if n_elem == xsize:
4241+
csize = c_array.size
4242+
if csize == xsize:
42434243
c = c_array.ravel()
42444244
else:
42454245
if c_array.shape in ((3,), (4,)):
@@ -4259,8 +4259,8 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
42594259
if c_array is None:
42604260
try: # Then is 'c' acceptable as PathCollection facecolors?
42614261
colors = mcolors.to_rgba_array(c)
4262-
n_elem = colors.shape[0]
4263-
if colors.shape[0] not in (0, 1, xsize):
4262+
csize = colors.shape[0]
4263+
if csize not in (0, 1, xsize):
42644264
# NB: remember that a single color is also acceptable.
42654265
# Besides *colors* will be an empty array if c == 'none'.
42664266
valid_shape = False
@@ -4270,7 +4270,7 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
42704270
raise ValueError(
42714271
"'c' argument has {nc} elements, which is not "
42724272
"acceptable for use with 'x' and 'y' with size {xs}."
4273-
.format(nc=n_elem, xs=xsize)
4273+
.format(nc=csize, xs=xsize)
42744274
)
42754275
else:
42764276
# Both the mapping *and* the RGBA conversion failed: pretty

0 commit comments

Comments
 (0)