I am hoping to plot observations (scatter plot) on top of model output (filled contours). To highlight regions of interest in the contour plot, I assign color scale breaks using the levels argument. When I plot the scatter on top, however, the colorscale is different. Is there a way to make the scatter color scale align with the contour color scale?
In the following example, I would like the point color to match the background color:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0,10).tolist()
y = np.arange(0,10).tolist()
z = np.ndarray((len(x),len(y)))
for i in range(0,10):
for j in range(0,10):
z[i][j] = x[i]*7+y[j]*3
im = plt.contourf(z, levels=[0,10,20,30,800,900,1000], cmap='rainbow')
cbar = plt.colorbar(im)
plt.scatter(np.meshgrid(x,y)[0], np.meshgrid(x,y)[1],
c=z, cmap='rainbow', edgecolor='k', s=100)
Output: 

