@@ -2800,6 +2800,48 @@ def test_line_colors(self):
28002800 ax = df .ix [:, [0 ]].plot (color = 'DodgerBlue' )
28012801 self ._check_colors (ax .lines , linecolors = ['DodgerBlue' ])
28022802
2803+ @slow
2804+ def test_line_colors_and_styles_subplots (self ):
2805+ from matplotlib import cm
2806+
2807+ custom_colors = 'rgcby'
2808+ df = DataFrame (randn (5 , 5 ))
2809+
2810+ axes = df .plot (subplots = True )
2811+ for ax , c in zip (axes , list (custom_colors )):
2812+ self ._check_colors (ax .get_lines (), linecolors = ['k' ])
2813+ tm .close ()
2814+
2815+ axes = df .plot (color = custom_colors , subplots = True )
2816+ for ax , c in zip (axes , list (custom_colors )):
2817+ self ._check_colors (ax .get_lines (), linecolors = [c ])
2818+ tm .close ()
2819+
2820+ rgba_colors = lmap (cm .jet , np .linspace (0 , 1 , len (df )))
2821+ for cmap in ['jet' , cm .jet ]:
2822+ axes = df .plot (colormap = cmap , subplots = True )
2823+ for ax , c in zip (axes , rgba_colors ):
2824+ self ._check_colors (ax .get_lines (), linecolors = [c ])
2825+ tm .close ()
2826+
2827+ # make color a list if plotting one column frame
2828+ # handles cases like df.plot(color='DodgerBlue')
2829+ axes = df .ix [:, [0 ]].plot (color = 'DodgerBlue' , subplots = True )
2830+ self ._check_colors (axes [0 ].lines , linecolors = ['DodgerBlue' ])
2831+
2832+ # single character style
2833+ axes = df .plot (style = 'r' , subplots = True )
2834+ for ax in axes :
2835+ self ._check_colors (ax .get_lines (), linecolors = ['r' ])
2836+ tm .close ()
2837+
2838+ # list of styles
2839+ styles = list ('rgcby' )
2840+ axes = df .plot (style = styles , subplots = True )
2841+ for ax , c in zip (axes , styles ):
2842+ self ._check_colors (ax .get_lines (), linecolors = [c ])
2843+ tm .close ()
2844+
28032845 @slow
28042846 def test_area_colors (self ):
28052847 from matplotlib import cm
@@ -2898,6 +2940,51 @@ def test_kde_colors(self):
28982940 rgba_colors = lmap (cm .jet , np .linspace (0 , 1 , len (df )))
28992941 self ._check_colors (ax .get_lines (), linecolors = rgba_colors )
29002942
2943+ @slow
2944+ def test_kde_colors_and_styles_subplots (self ):
2945+ tm ._skip_if_no_scipy ()
2946+ _skip_if_no_scipy_gaussian_kde ()
2947+
2948+ from matplotlib import cm
2949+
2950+ custom_colors = 'rgcby'
2951+ df = DataFrame (randn (5 , 5 ))
2952+
2953+ axes = df .plot (kind = 'kde' , subplots = True )
2954+ for ax , c in zip (axes , list (custom_colors )):
2955+ self ._check_colors (ax .get_lines (), linecolors = ['k' ])
2956+ tm .close ()
2957+
2958+ axes = df .plot (kind = 'kde' , color = custom_colors , subplots = True )
2959+ for ax , c in zip (axes , list (custom_colors )):
2960+ self ._check_colors (ax .get_lines (), linecolors = [c ])
2961+ tm .close ()
2962+
2963+ rgba_colors = lmap (cm .jet , np .linspace (0 , 1 , len (df )))
2964+ for cmap in ['jet' , cm .jet ]:
2965+ axes = df .plot (kind = 'kde' , colormap = cmap , subplots = True )
2966+ for ax , c in zip (axes , rgba_colors ):
2967+ self ._check_colors (ax .get_lines (), linecolors = [c ])
2968+ tm .close ()
2969+
2970+ # make color a list if plotting one column frame
2971+ # handles cases like df.plot(color='DodgerBlue')
2972+ axes = df .ix [:, [0 ]].plot (kind = 'kde' , color = 'DodgerBlue' , subplots = True )
2973+ self ._check_colors (axes [0 ].lines , linecolors = ['DodgerBlue' ])
2974+
2975+ # single character style
2976+ axes = df .plot (kind = 'kde' , style = 'r' , subplots = True )
2977+ for ax in axes :
2978+ self ._check_colors (ax .get_lines (), linecolors = ['r' ])
2979+ tm .close ()
2980+
2981+ # list of styles
2982+ styles = list ('rgcby' )
2983+ axes = df .plot (kind = 'kde' , style = styles , subplots = True )
2984+ for ax , c in zip (axes , styles ):
2985+ self ._check_colors (ax .get_lines (), linecolors = [c ])
2986+ tm .close ()
2987+
29012988 @slow
29022989 def test_boxplot_colors (self ):
29032990
0 commit comments