import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, np.pi*4, 100)
y = np.linspace(0, np.pi*4, 100)
xx, yy = np.meshgrid(x, y)
v = np.sin(xx) + np.cos(yy)
extent = [x.min(), x.max(), y.min(), y.max()]

vmin, vmax = -2, 2
ticks = np.linspace(vmin, vmax, 9)

plt.imshow(v, cmap=plt.cm.Blues, extent=extent, vmin=vmin, vmax=vmax)
cbar = plt.colorbar()
cbar.set_ticks(ticks)