From: <shuwj5460@16...>  20061225 06:46:06

> contourf is not drawing in raster modeit is generating filled=20 > polygons. What you are seeing is the fact that when it follows the edge= =20 > of a masked region, it does so in a stairstep fashion. This is inherent= =20 > in the algorithm being used. it seems that the filled polygon is composed of a set of points in some a contour and some points in the 'drawn' edge which offsets with the real edge of a masked region.=20 > I have thought a little bit about ways of=20 > making it at least take a diagonal path when reasonable so as to reduce= =20 > the jaggy effect. I am not at all sure it would be worth the trouble,=20 > thoughI expect it would be a lot of work for only a little gain. I do think that matplotlib can do a very good job now. the same time i think it's valuable to take some time to work out this little flaw. maybe there're some tricky methods. 1) make a contourf plot on the whole rectangle mesh with no mask. 2) make a mask picture of the same size with the contourf plot. black in mask ploygon and white outside. 3) do AND operation on contourf plot and the mask picture and outside the mask polygon will be clipped. x,y is axes array. z is mesh grid data array. zz is mesh grid data array with mask. p is polygon for the edge. cs=3Dcontourf(x,y,z) > contourf plot,identifies A.=20 cs2=3Dcontour(x,y,zz) =20 clabel(cs2,....) > label at the right position inside the mask polygon. draw_polygon(p,fillcolor=3Dblack) > make a mask picture of the same size with A,identifies B. A and B drawing. > it seems that cairo and agg can do this. i don't know how to do in matplotlib.but i'm sure some functions work for it. there's no need to change the mask array when we zoom the picture now because the mask picture is redrawn dynamicaly and 'vectorly' =2E >=20 > To get around this you may want to use some interpolation/extrapolation= =20 > to extend your data one grid point into the masked region, then contour= =20 > with the reduced masked region, then plot your own filled polygon on top= =20 > of the contour plot to define the masked region more precisely to your=20 > taste. yes,filled contour map with smooth edge can be drawn with a more high resolution mask array given.it's not a hard job.However,there's some disadvantages in this way.firstly,mask array will have much larger size than before and x,y arrays will be enlarged.these steps should be repeated every time we wanna zoom the picture. > Yes, I agree that this is a pain, and that the present contour/contourf= =20 > routine is not ideal (although it is very clever and I suspect very=20 > fast). If you can find a better filled contour routine with a BSDstyle= =20 > license, or even a clear and complete description of a superior=20 > algorithm that could be implemented without running into copyright or=20 > patent problems, please point it out to us. >=20 > There is one interesting difference between the algorithm we use (taken= =20 > from the gist package) and the one used by Matlab: ours generates=20 > polygons that enclose only a given levelpolygons do not=20 > overlapwhereas Matlab's generates polygons that stack. As a result,=20 > ours is suitable for use with alpha blending, whereas Matlab's is not=20 > (last time I looked, anyway). > Eric would you like to add some more interpolation algorithm such as kriging ect.to matplotlib? there are many interpolation source codes in public. shu =20 <> 