8000 Merge pull request #14399 from anntzer/datawarn · matplotlib/matplotlib@d8ceee6 · GitHub
[go: up one dir, main page]

Skip to content

Commit d8ceee6

Browse files
authored
Merge pull request #14399 from anntzer/datawarn
Improve warning for case where data kwarg entry is ambiguous.
2 parents 537535d + bfec0e7 commit d8ceee6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,13 @@ def __call__(self, *args, **kwargs):
194194
else:
195195
if replaced[1] is not args[1]: # case 2a)
196196
cbook._warn_external(
197-
"Second argument {!r} is ambiguous: could be a "
198-
"color spec but is in data; using as data. "
199-
"Either rename the entry in data or use three "
200-
"arguments to plot.".format(args[1]),
197+
f"Second argument {args[1]!r} is ambiguous: could "
198+
f"be a format string but is in 'data'; using as "
199+
f"data. If it was intended as data, set the "
200+
f"format string to an empty string to suppress "
201+
f"this warning. If it was intended as a format "
202+
f"string, explicitly pass the x-values as well. "
203+
f"Alternatively, rename the entry in 'data'.",
201204
RuntimeWarning)
202205
label_namer_idx = 1
203206
else: # case 2b)

0 commit comments

Comments
 (0)
0