Jae-Joon Lee wrote: > Reading Eric's reply on the previous email, my impression is that > contourf is not supposed to draw the boundary (no stroke!). But it > seems it still does. > > for c in cs.collections: > c.set_edgecolor("none") > > After this, I can get rid of the vertical lines. > I can see slight gaps between filled regions, though.
I am not sure they are really gaps, but it looks to me like there is no perfect way to get the region boundaries rendered under all conditions--any combination of settings of antialiasing, boundary stroking, and alpha, can produce visual artifacts of the rendering or errors in the representation of data. Different renderers handle the same boundaries in different ways, so that sometimes an artifact will be annoying with one renderer and absent with another. > > While contourf create PolyCollection with edgecolors="none", the > edgecolor are overridden later by the set_color call inside the > ContourSet.changed method. > > It may be better to draw the boundary for alpha=1, but better not otherwise. It looks to me like there are always compromises, but overall it is best for contour not to draw the boundaries at all. I think that was my intention all along, and I suspect it was accidentally thwarted along the way by some change--but I have not tried to track down the history. What matters is only how we can get the best behavior and the best API. I have made some minimal changes to fix what seem to me to be blatent bugs (so I made the changes in the 98.5 maint and propagated them via svnmerge). The code could benefit from a much more thorough review and testing, and probably some substantial changes. It may be that some tweaking of antialiased on/off, whether and how to draw boundaries, etc. will always have to be left to the user, depending on backend used and the characteristics of the plot. > > Anyhow, there is a little bug in how alpha value is treated in the > contourf(maybe contour also). I fixed this also--the problem was in colors.py, so it was quite general. Thanks for finding these problems! I was completely wrong in my original diagnosis of the contourf problem with alpha. The solution I had in mind, which is to process the path information so as to generate multiply-connected regions instead of using branch cuts, may still have some advantages--in particular, it would make it possible to stroke the boundaries, and/or to use the same boundaries for selected line contours, instead of having to calculate them independently (and sometimes differently) with a call to contour. It is my understanding that all backends now should be able to handle multiply-connected regions. Eric > > In [2]: CS = plt.contourf(X, Y, Z,alpha = .7) > > In [3]: print CS.collections[0].get_facecolor() > [[ 0. 0. 0.82085561 0.49 ]] > > Note that the alpha of the resulting facecolor is 0.7**2. > It seems that both PolygonCollection and ContourSet are applying the > alpha value. > I may able to look at this sometime tomorrow, but feel free to take over. > > Regards, > > -JJ > ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users