@@ -236,7 +236,7 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
236
236
237
237
def _label_axis (ax , kind = 'x' , label = '' , position = 'top' ,
238
238
ticks = True , rotate = False ):
239
-
239
+
240
240
from matplotlib .artist import setp
241
241
if kind == 'x' :
242
242
ax .set_xlabel (label , visible = True )
@@ -247,14 +247,14 @@ def _label_axis(ax, kind='x', label='', position='top',
247
247
setp (ax .get_xticklabels (), rotation = 90 )
248
248
elif kind == 'y' :
249
249
ax .yaxis .set_visible (True )
250
- ax .set_ylabel (label , visible = True )
250
+ ax .set_ylabel (label , visible = True )
251
251
# ax.set_ylabel(a)
252
252
ax .yaxis .set_ticks_position (position )
253
253
ax .yaxis .set_label_position (position )
254
- return
255
-
256
-
257
-
254
+ return
255
+
256
+
257
+
258
258
259
259
260
260
def _gca ():
@@ -1026,6 +1026,19 @@ def _get_style(self, i, col_name):
1026
1026
1027
1027
return style or None
1028
1028
1029
+ def _get_colors (self ):
1030
+ import matplotlib .pyplot as plt
1031
+ cycle = plt .rcParams .get ('axes.color_cycle' , list ('bgrcmyk' ))
1032
+ if isinstance (cycle , basestring ):
1033
+ cycle = list (cycle )
1034
+ colors = self .kwds .get ('color' , cycle )
1035
+ return colors
1036
+
1037
+ def _maybe_add_color (self , colors , kwds , style , i ):
1038
+ has_color = 'color' in kwds
1039
+ if has_color and (style is None or re .match ('[a-z]+' , style ) is None ):
1040
+ kwds ['color' ] = colors [i % len (colors )]
1041
+
1029
1042
1030
1043
class KdePlot (MPLPlot ):
1031
1044
def __init__ (self , data , ** kwargs ):
@@ -1034,6 +1047,7 @@ def __init__(self, data, **kwargs):
1034
1047
def _make_plot (self ):
1035
1048
from scipy .stats import gaussian_kde
1036
1049
plotf = self ._get_plot_function ()
1050
+ colors = self ._get_colors ()
1037
1051
for i , (label , y ) in enumerate (self ._iter_data ()):
1038
1052
ax = self ._get_ax (i )
1039
1053
style = self ._get_style (i , label )
@@ -1049,6 +1063,7 @@ def _make_plot(self):
1049
1063
y = gkde .evaluate (ind )
1050
1064
kwds = self .kwds .copy ()
1051
1065
kwds ['label' ] = label
1066
+ self ._maybe_add_color (colors , kwds , style , i )
1052
1067
if style is None :
1053
1068
args = (ax , ind , y )
1054
1069
else :
@@ -1119,19 +1134,6 @@ def _use_dynamic_x(self):
1119
1134
1120
1135
return (freq is not None ) and self ._is_dynamic_freq (freq )
1121
1136
1122
- def _get_colors (self ):
1123
- import matplotlib .pyplot as plt
1124
- cycle = plt .rcParams .get ('axes.color_cycle' , list ('bgrcmyk' ))
1125
- if isinstance (cycle , basestring ):
1126
- cycle = list (cycle )
1127
- colors = self .kwds .get ('color' , cycle )
1128
- return colors
1129
-
1130
- def _maybe_add_color (self , colors , kwds , style , i ):
1131
- has_color = 'color' in kwds
1132
- if has_color and (style is None or re .match ('[a-z]+' , style ) is None ):
1133
- kwds ['color' ] = colors [i % len (colors )]
1134
-
1135
1137
def _make_plot (self ):
1136
1138
import pandas .tseries .plotting as tsplot
1137
1139
# this is slightly deceptive
0 commit comments