> contourf is not drawing in raster mode--it is generating filled=20
> polygons. What you are seeing is the fact that when it follows the edge=
> of a masked region, it does so in a stairstep fashion. This is inherent=
> 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=
> the jaggy effect. I am not at all sure it would be worth the trouble,=20
> though--I 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
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'
> To get around this you may want to use some interpolation/extrapolation=
> to extend your data one grid point into the masked region, then contour=
> with the reduced masked region, then plot your own filled polygon on top=
> of the contour plot to define the masked region more precisely to your=20
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=
> 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 BSD-style=
> 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.
> There is one interesting difference between the algorithm we use (taken=
> from the gist package) and the one used by Matlab: ours generates=20
> polygons that enclose only a given level--polygons do not=20
> overlap--whereas 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).
would you like to add some more interpolation algorithm such as kriging
ect.to matplotlib? there are many interpolation source codes in public.