12
12
from pandas .tseries .offsets import DateOffset
13
13
14
14
def scatter_matrix (frame , alpha = 0.5 , figsize = None , ax = None , grid = False ,
15
- diagonal = 'hist' , ** kwds ):
15
+ diagonal = 'hist' , marker = '.' , ** kwds ):
16
16
"""
17
17
Draw a matrix of scatter plots.
18
18
@@ -54,7 +54,8 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
54
54
ind = np .linspace (min (y ), max (y ), 1000 )
55
55
axes [i , j ].plot (ind , gkde .evaluate (ind ), ** kwds )
56
56
else :
57
- axes [i , j ].scatter (df [b ], df [a ], alpha = alpha , ** kwds )
57
+ axes [i , j ].scatter (df [b ], df [a ], marker = marker , alpha = alpha ,
58
+ ** kwds )
58
59
59
60
axes [i , j ].set_xlabel ('' )
60
61
axes [i , j ].set_ylabel ('' )
@@ -295,7 +296,7 @@ def _adorn_subplots(self):
295
296
ax .grid (self .grid )
296
297
297
298
if self .legend and not self .subplots :
298
- self .ax .legend (loc = 'best' )
299
+ self .ax .legend (loc = 'best' , title = self . legend_title )
299
300
300
301
if self .title :
301
302
if self .subplots :
@@ -309,6 +310,14 @@ def _adorn_subplots(self):
309
310
# ax_.set_xticks(self.xticks)
310
311
ax_ .set_xticklabels (xticklabels , rotation = self .rot )
311
312
313
+ @property
314
+ def legend_title (self ):
315
+ if hasattr (self .data , 'columns' ):
316
+ stringified = map (str , self .data .columns .names )
317
+ return ',' .join (stringified )
318
+ else :
319
+ return None
320
+
312
321
@cache_readonly
313
322
def plt (self ):
314
323
import matplotlib .pyplot as plt
@@ -565,7 +574,8 @@ def _make_plot(self):
565
574
# loc=2, borderaxespad=0.)
566
575
# self.fig.subplots_adjust(right=0.80)
567
576
568
- ax .legend (patches , labels , loc = 'best' )
577
+ ax .legend (patches , labels , loc = 'best' ,
578
+ title = self .legend_title )
569
579
570
580
self .fig .subplots_adjust (top = 0.8 , wspace = 0 , hspace = 0 )
571
581
0 commit comments