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

Skip to content

Commit c1add44

Browse files
committed
Simplify error messages via f-strings.
1 parent d7db876 commit c1add44

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4268,18 +4268,14 @@ def _parse_scatter_color_args(c, edgecolors, kwargs, xsize,
42684268
except ValueError:
42694269
if not valid_shape: # but at least one conversion succeeded.
42704270
raise ValueError(
4271-
"'c' argument has {nc} elements, which is not "
4272-
"acceptable for use with 'x' and 'y' with size {xs}."
4273-
.format(nc=csize, xs=xsize)
4274-
)
4271+
f"'c' argument has {csize} elements, which is "
4272+
"inconsistent with 'x' and 'y' with size {xsize}.")
42754273
else:
42764274
# Both the mapping *and* the RGBA conversion failed: pretty
42774275
# severe failure => one may appreciate a verbose feedback.
42784276
raise ValueError(
4279-
"'c' argument must be a mpl color, a sequence of mpl "
4280-
"colors or a sequence of numbers, not {}."
4281-
.format(c) # note: could be long depending on c
4282-
)
4277+
f"'c' argument must be a mpl color, a sequence of mpl "
4278+
"colors, or a sequence of numbers, not {c}.")
42834279
else:
42844280
colors = None # use cmap, norm after collection is created
42854281
return c, colors, edgecolors

0 commit comments

Comments
 (0)