Skip to content

Commit c7f314b

Browse files
committed
Display bad format string in error message.
I had something like `for i in range(n): plot(..., f"oC{i}")` which works for n up to 10, but for greater values one gets "oC10" which is not supported (which is reasonable, as some single-digit strings are actually *marker* abbreviations); mentioning the full format string in the error message ("Unrecognized character 0 in format string 'oC10'") makes it clearer.
1 parent f393802 commit c7f314b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/axes/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def _process_plot_format(fmt):
197197
i += 2
198198
else:
199199
raise ValueError(
200-
'Unrecognized character %c in format string' % c)
200+
f'Unrecognized character {c} in format string {fmt!r}')
201201

202202
if linestyle is None and marker is None:
203203
linestyle = mpl.rcParams['lines.linestyle']

0 commit comments

Comments
 (0)