@@ -59,25 +59,15 @@ def _plot_args_replacer(args, data):
5959 return ["y" , "c" ]
6060 # it's data, but could be a color code like 'ro' or 'b--'
6161 # -> warn the user in that case...
62- arg2 = args [1 ]
63- if is_string_like (arg2 ) and len (arg2 ) <= 3 :
64- # all possible linestyles and color codes -> see doc of plot
65- reserved_ls = ["-" , "--" , "-." , ":" , "." , "," , "o" , "v" , "^" , "<" ,
66- ">" , "1" , "2" , "3" , "4" , "s" , "p" , "*" , "h" , "H" ,
67- "+" , "x" , "D" , "d" , "|" , "_" ]
68- reserved_cc = ["b" , "r" , "c" , "m" , "y" , "k" , "w" ]
69- # remove the line style part
70- for ls in reserved_ls :
71- if ls in arg2 :
72- arg2 = arg2 .replace (ls , '' )
73- continue
74- # can now only be a color code...
75- if arg2 in reserved_cc :
76- import warnings
77- msg = "Second argument is ambiguous: could be a color spec " \
78- "but is in data. Using as data.\n Either rename the " \
79- "entry in data or use three arguments to plot."
80- warnings .warn (msg , RuntimeWarning , stacklevel = 3 )
62+ try :
63+ _process_plot_format (args [1 ])
64+ except ValueError :
65+ pass
66+ else :
67+ msg = "Second argument is ambiguous: could be a color spec " \
68+ "but is in data. Using as data.\n Either rename the " \
69+ "entry in data or use three arguments to plot."
70+ warnings .warn (msg , RuntimeWarning , stacklevel = 3 )
8171 return ["x" , "y" ]
8272 elif len (args ) == 3 :
8373 return ["x" , "y" , "c" ]
0 commit comments