If you have predefined ranges and want to use specific colors for those ranges you can declare custom colormap. For example:
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.colors
x = np.linspace(-2,2,500)
y = np.linspace(-2,2,500)
XX, YY = np.meshgrid(x, y)
Z = np.sin(...