From c7f314b8e668dd8b3f4d81a2ab19a34a3e8450c5 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 23 Jan 2022 22:09:52 +0100 Subject: [PATCH] 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. --- lib/matplotlib/axes/_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 194f2f63cbaa..85c5ada67dfe 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -197,7 +197,7 @@ def _process_plot_format(fmt): i += 2 else: raise ValueError( - 'Unrecognized character %c in format string' % c) + f'Unrecognized character {c} in format string {fmt!r}') if linestyle is None and marker is None: linestyle = mpl.rcParams['lines.linestyle'] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy