mons
['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
# just get the first 5 for illustration purposes
df = DataFrame(randn(201, len(mons)), columns=mons,
index=arange(1901, 2102))[:5]
df.iloc[:, :5] # subset of the frame
Jan | Feb | Mar | Apr | May | |
---|---|---|---|---|---|
1901 | -0.744 | -0.163 | 0.411 | -1.336 | 0.516 |
1902 | -0.357 | -1.125 | -2.232 | 0.673 | 0.736 |
1903 | -0.119 | 0.563 | 0.356 | 1.526 | -1.086 |
1904 | -0.839 | 0.460 | 0.312 | 0.922 | -1.575 |
1905 | -0.902 | -0.671 | -0.383 | -1.795 | 1.445 |
from mpl_toolkits.axes_grid1 import ImageGrid
fig = figure(figsize=(20, 100))
grid = ImageGrid(fig, 111, nrows_ncols=(1, 1),
direction='row', axes_pad=0.05, add_all=True,
label_mode='1', share_all=False,
cbar_location='right', cbar_mode='single',
cbar_size='10%', cbar_pad=0.05)
ax = grid[0]
ax.set_title('A', fontsize=40)
ax.tick_params(axis='both', direction='out', labelsize=20)
im = ax.imshow(df.values, interpolation='nearest', vmax=df.max().max(),
vmin=df.min().min())
ax.cax.colorbar(im)
ax.cax.tick_params(labelsize=20)
ax.set_xticks(arange(df.shape[1]))
ax.set_xticklabels(mons)
ax.set_yticks(arange(df.shape[0]))
ax.set_yticklabels(df.index)