@@ -46,65 +46,56 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False,
46
46
gkde = stats .gaussian_kde (y )
47
47
ind = np .linspace (min (y ), max (y ), 1000 )
48
48
axes [i , j ].plot (ind , gkde .evaluate (ind ), ** kwds )
49
- axes [i , j ].yaxis .set_visible (False )
50
- axes [i , j ].xaxis .set_visible (False )
51
- if i == 0 and j == 0 :
52
- axes [i , j ].yaxis .set_ticks_position ('left' )
53
- axes [i , j ].yaxis .set_label_position ('left' )
54
- axes [i , j ].yaxis .set_visible (True )
55
- if i == n - 1 and j == n - 1 :
56
- axes [i , j ].yaxis .set_ticks_position ('right' )
57
- axes [i , j ].yaxis .set_label_position ('right' )
58
- axes [i , j ].yaxis .set_visible (True )
59
49
else :
60
50
axes [i , j ].scatter (df [b ], df [a ], alpha = alpha , ** kwds )
61
- axes [i , j ].set_xlabel ('' )
62
- axes [i , j ].set_ylabel ('' )
63
- axes [i , j ].set_xticklabels ([])
64
- axes [i , j ].set_yticklabels ([])
65
- ticks = df .index
66
-
67
- is_datetype = ticks .inferred_type in ('datetime' , 'date' ,
68
- 'datetime64' )
69
-
70
- if ticks .is_numeric () or is_datetype :
71
- """
72
- Matplotlib supports numeric values or datetime objects as
73
- xaxis values. Taking LBYL approach here, by the time
74
- matplotlib raises exception when using non numeric/datetime
75
- values for xaxis, several actions are already taken by plt.
76
- """
77
- ticks = ticks ._mpl_repr ()
78
-
79
- # setup labels
80
- if i == 0 and j % 2 == 1 :
81
- axes [i , j ].set_xlabel (b , visible = True )
82
- #axes[i, j].xaxis.set_visible(True)
83
- axes [i , j ].set_xlabel (b )
84
- axes [i , j ].set_xticklabels (ticks )
85
- axes [i , j ].xaxis .set_ticks_position ('top' )
86
- axes [i , j ].xaxis .set_label_position ('top' )
87
- if i == n - 1 and j % 2 == 0 :
88
- axes [i , j ].set_xlabel (b , visible = True )
89
- #axes[i, j].xaxis.set_visible(True)
90
- axes [i , j ].set_xlabel (b )
91
- axes [i , j ].set_xticklabels (ticks )
92
- axes [i , j ].xaxis .set_ticks_position ('bottom' )
93
- axes [i , j ].xaxis .set_label_position ('bottom' )
94
- if j == 0 and i % 2 == 0 :
95
- axes [i , j ].set_ylabel (a , visible = True )
96
- #axes[i, j].yaxis.set_visible(True)
97
- axes [i , j ].set_ylabel (a )
98
- axes [i , j ].set_yticklabels (ticks )
99
- axes [i , j ].yaxis .set_ticks_position ('left' )
100
- axes [i , j ].yaxis .set_label_position ('left' )
101
- if j == n - 1 and i % 2 == 1 :
102
- axes [i , j ].set_ylabel (a , visible = True )
103
- #axes[i, j].yaxis.set_visible(True)
104
- axes [i , j ].set_ylabel (a )
105
- axes [i , j ].set_yticklabels (ticks )
106
- axes [i , j ].yaxis .set_ticks_position ('right' )
107
- axes [i , j ].yaxis .set_label_position ('right' )
51
+
52
+ axes [i , j ].set_xlabel ('' )
53
+ axes [i , j ].set_ylabel ('' )
54
+ axes [i , j ].set_xticklabels ([])
55
+ axes [i , j ].set_yticklabels ([])
56
+ ticks = df .index
57
+
58
+ is_datetype = ticks .inferred_type in ('datetime' , 'date' ,
59
+ 'datetime64' )
60
+
61
+ if ticks .is_numeric () or is_datetype :
62
+ """
63
+ Matplotlib supports numeric values or datetime objects as
64
+ xaxis values. Taking LBYL approach here, by the time
65
+ matplotlib raises exception when using non numeric/datetime
66
+ values for xaxis, several actions are already taken by plt.
67
+ """
68
+ ticks = ticks ._mpl_repr ()
69
+
70
+ # setup labels
71
+ if i == 0 and j % 2 == 1 :
72
+ axes [i , j ].set_xlabel (b , visible = True )
73
+ #axes[i, j].xaxis.set_visible(True)
74
+ axes [i , j ].set_xlabel (b )
75
+ axes [i , j ].set_xticklabels (ticks )
76
+ axes [i , j ].xaxis .set_ticks_position ('top' )
77
+ axes [i , j ].xaxis .set_label_position ('top' )
78
+ if i == n - 1 and j % 2 == 0 :
79
+ axes [i , j ].set_xlabel (b , visible = True )
80
+ #axes[i, j].xaxis.set_visible(True)
81
+ axes [i , j ].set_xlabel (b )
82
+ axes [i , j ].set_xticklabels (ticks )
83
+ axes [i , j ].xaxis .set_ticks_position ('bottom' )
84
+ axes [i , j ].xaxis .set_label_position ('bottom' )
85
+ if j == 0 and i % 2 == 0 :
86
+ axes [i , j ].set_ylabel (a , visible = True )
87
+ #axes[i, j].yaxis.set_visible(True)
88
+ axes [i , j ].set_ylabel (a )
89
+ axes [i , j ].set_yticklabels (ticks )
90
+ axes [i , j ].yaxis .set_ticks_position ('left' )
91
+ axes [i , j ].yaxis .set_label_position ('left' )
92
+ if j == n - 1 and i % 2 == 1 :
93
+ axes [i , j ].set_ylabel (a , visible = True )
94
+ #axes[i, j].yaxis.set_visible(True)
95
+ axes [i , j ].set_ylabel (a )
96
+ axes [i , j ].set_yticklabels (ticks )
97
+ axes [i , j ].yaxis .set_ticks_position ('right' )
98
+ axes [i , j ].yaxis .set_label_position ('right' )
108
99
109
100
axes [i , j ].grid (b = grid )
110
101
0 commit comments