In [1]:
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
%matplotlib inline
In [2]:
grid = np.array([
[1,2,3],
[4,5,6],
[7,8,9]
])
In [15]:
fig, ax = plt.subplots(nrows=1, ncols=1, sharex=True )
im = ax.imshow(grid, interpolation='nearest', cmap='Blues' )
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.15)
cb = plt.colorbar(im, ax=ax, cax = cax)