@@ -553,6 +553,23 @@ def __init__(self, data, kind=None, by=None, subplots=False, sharex=True,
553
553
554
554
self .kwds = kwds
555
555
556
+ self ._validate_color_args ()
557
+
558
+ def _validate_color_args (self ):
559
+ from pandas import DataFrame
560
+ if 'color' not in self .kwds and 'colors' in self .kwds :
561
+ warnings .warn (("'colors' is being deprecated. Please use 'color'"
562
+ "instead of 'colors'" ))
563
+ colors = self .kwds .pop ('colors' )
564
+ self .kwds ['color' ] = colors
565
+
566
+ if ('color' in self .kwds and
567
+ (isinstance (self .data , Series ) or
568
+ isinstance (self .data , DataFrame ) and len (self .data .columns ) == 1 )):
569
+ #support series.plot(color='green')
570
+ self .kwds ['color' ] = [self .kwds ['color' ]]
571
+
572
+
556
573
def _iter_data (self ):
557
574
from pandas .core .frame import DataFrame
558
575
if isinstance (self .data , (Series , np .ndarray )):
@@ -858,14 +875,6 @@ class LinePlot(MPLPlot):
858
875
def __init__ (self , data , ** kwargs ):
859
876
self .mark_right = kwargs .pop ('mark_right' , True )
860
877
MPLPlot .__init__ (self , data , ** kwargs )
861
- if 'color' not in self .kwds and 'colors' in self .kwds :
862
- warnings .warn (("'colors' is being deprecated. Please use 'color'"
863
- "instead of 'colors'" ))
864
- colors = self .kwds .pop ('colors' )
865
- self .kwds ['color' ] = colors
866
- if 'color' in self .kwds and isinstance (self .data , Series ):
867
- #support series.plot(color='green')
868
- self .kwds ['color' ] = [self .kwds ['color' ]]
869
878
870
879
def _index_freq (self ):
871
880
from pandas .core .frame import DataFrame
0 commit comments