Based from your revised question I get what you mean. This can still be done using add_lines
. This function adds the lines from a non-filled contour plot to a colorbar. The documentation can be found here.
So, by first defining the colorbar based on your pcolor
plot you can later add the lines from contour
to that colorbar:
import numpy
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
#Generate data
delta = 0.025
x = numpy.arange(-3.0, 3.0, delta)
y = numpy.arange(-2.0, 2.0, delta)
X, Y = numpy.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)
#Plot
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
PC = ax1.pcolor(X, Y, Z)
CF = ax1.contour(X, Y, Z, 50, colors = "black")
cbar = plt.colorbar(PC)
cbar.add_lines(CF)
plt.show()
