@@ -55,24 +55,26 @@ def _plot_args_replacer(args, data):
5555return ["y" ]
5656elif len (args )== 2 :
5757# this can be two cases: x,y or y,c
58+ if (not args [1 ]in data and
59+ not (hasattr (data ,'dtype' )and
60+ hasattr (data .dtype ,'names' )and
61+ data .dtype .names is not None and
62+ args [1 ]in data .dtype .names )):
63+ # this is not in data, so just assume that it is something which
64+ # will not get replaced (color spec or array like).
65+ return ["y" ,"c" ]
5866# it's data, but could be a color code like 'ro' or 'b--'
5967# -> warn the user in that case...
60-
6168try :
6269_process_plot_format (args [1 ])
6370except ValueError :
6471pass
6572else :
66- # arg can be parsed into colour; verify arg is not data
67- if not args [1 ]in data :
68- return ["y" ,"c" ]
69- else :
70- warnings .warn (
71- "Second argument {!r} is ambiguous: could be a color spec "
72- "but is in data; using as data. Either rename the entry "
73- "in data or use three arguments to plot." .format (args [1 ]),
74- RuntimeWarning ,stacklevel = 3 )
75-
73+ warnings .warn (
74+ "Second argument {!r} is ambiguous: could be a color spec but "
75+ "is in data; using as data. Either rename the entry in data "
76+ "or use three arguments to plot." .format (args [1 ]),
77+ RuntimeWarning ,stacklevel = 3 )
7678return ["x" ,"y" ]
7779elif len (args )== 3 :
7880return ["x" ,"y" ,"c" ]