To mitigate the problem described here, I\'m trying to draw my pcolor
plot in two complimentary parts. I have X
and Y
data that corre
I see maybe I wasn't clear enough on my quick comment on the other question, but by masking I mean that the grid needs to by masked, not the values.
from numpy import array, ma
import matplotlib.pyplot as plt
lons = array([[ 100., 120., 140., 160., 180.],
[ 120., 140., 160., 180., -160.],
[ 140., 160., 180., -160., -140.],
[ 160., 180., -160., -140., -120.],
[ 180., -160., -140., -120., -100.],
[-160., -140., -120., -100., -80.]])
lats = array([[ 0., 10., 20., 30., 40.],
[ 0., 10., 20., 30., 40.],
[ 0., 10., 20., 30., 40.],
[ 0., 10., 20., 30., 40.],
[ 0., 10., 20., 30., 40.],
[ 0., 10., 20., 30., 40.]])
bts = array([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24],
[25, 26, 27, 28, 29]])
fig, (ax,ax2) = plt.subplots(ncols=2)
ax.pcolor(ma.masked_where(lons>0, lons),
ma.masked_where(lons>0, lats),
ma.masked_where(lons>0, bts))
ax2.pcolor(ma.masked_where(lons<0, lons),
ma.masked_where(lons<0, lats),
ma.masked_where(lons<0, bts))
plt.show()