Shu: I'd make a mask by finding the points on the grid that are outside

your polygon. Then use that mask to create a masked array from your

data (masking the points you don't want to plot). matplotlib's contourf

knows how to deal with masked arrays (at least when the masked region

isn't too complicated). The basemap toolkit can plot data on map

projections with coastlines and political boundaries (as in the PyNGL

example you forwarded).-Jeff

Thanks Jeff.Following your advice I have successed to get a masked

contour plot.Matplotlib can do it good.

in my case,

x is array for axis X and y for axis Y

z is data for contour

mask is a mask array with the same dimensions as z.

ma.array(z,mask=mask)

contour(x,y,z)

In my case,I used kriging interpolation to interpolate an array of

irregulation station data into a rectangular grid first and then plot

contour with matplotlib. I wanna know if matplotlib have such

interpolation functions or geostatistics functions.

Thanks again.

shu