63
63
im = ax .imshow (harvest )
64
64
65
65
# Show all ticks and label them with the respective list entries
66
- ax .set_xticks (np .arange (len (farmers )), labels = farmers )
67
- ax .set_yticks (np .arange (len (vegetables )), labels = vegetables )
68
-
69
- # Rotate the tick labels and set their alignment.
70
- plt .setp (ax .get_xticklabels (), rotation = 45 , ha = "right" ,
71
- rotation_mode = "anchor" )
66
+ ax .set_xticks (range (len (farmers )), labels = farmers ,
67
+ rotation = 45 , ha = "right" , rotation_mode = "anchor" )
68
+ ax .set_yticks (range (len (vegetables )), labels = vegetables )
72
69
73
70
# Loop over data dimensions and create text annotations.
74
71
for i in range (len (vegetables )):
@@ -137,17 +134,14 @@ def heatmap(data, row_labels, col_labels, ax=None,
137
134
cbar .ax .set_ylabel (cbarlabel , rotation = - 90 , va = "bottom" )
138
135
139
136
# Show all ticks and label them with the respective list entries.
140
- ax .set_xticks (np .arange (data .shape [1 ]), labels = col_labels )
141
- ax .set_yticks (np .arange (data .shape [0 ]), labels = row_labels )
137
+ ax .set_xticks (range (data .shape [1 ]), labels = col_labels ,
138
+ rotation = - 30 , ha = "right" , rotation_mode = "anchor" )
139
+ ax .set_yticks (range (data .shape [0 ]), labels = row_labels )
142
140
143
141
# Let the horizontal axes labeling appear on top.
144
142
ax .tick_params (top = True , bottom = False ,
145
143
labeltop = True , labelbottom = False )
146
144
147
- # Rotate the tick labels and set their alignment.
148
- plt .setp (ax .get_xticklabels (), rotation = - 30 , ha = "right" ,
149
- rotation_mode = "anchor" )
150
-
151
145
# Turn spines off and create white grid.
152
146
ax .spines [:].set_visible (False )
153
147
0 commit comments