plotting a pcolormesh and fill

I have a pcolormest and a fill that are plotted on the same graph (they have the same scale). Is there an easy way
to only plot the values of pcolormesh that lie in the fill?

pcolormesh(oX, oY, test, shading=‘flat’, cmap=cm.gray_r)
fill([-x1,x2,x2,-x1], [-y1,-y1,y2,y2], ‘b’, alpha=0.2, edgecolor=‘r’)

···


“The game of science can accurately be described as a never-ending insult to human intelligence.” - João Magueijo

Bryan Fodness wrote:

I have a pcolormest and a fill that are plotted on the same graph (they have the same scale). Is there an easy way
to only plot the values of pcolormesh that lie in the fill?

pcolormesh(oX, oY, test, shading='flat', cmap=cm.gray_r)
fill([-x1,x2,x2,-x1], [-y1,-y1,y2,y2], 'b', alpha=0.2, edgecolor='r')

Do you mean something like this?

ii = (oX > -x1) & (oX < x2)
jj = (oY > -y1) & (oY > y2)

pcolormesh(oX[ii], oY[jj], test[jj,][:,ii])

This assumes your oX and oY are 1-D, so you are plotting rectangular mesh. Correct?

Eric