contourf linewidth=1 help request

Eric Firing wrote:

Jordan,

Thanks, now I see the problem and where it is coming from. In contour.py, near the bottom, in the contourf method, change the linewidth from 1 to 0.01, so the line reads:
            col = PolyCollection(nlist, linewidths=(0.01,))

I think this will be OK; based on the comment below the line, I think I found that using a linewidth of zero was problematic, so I probably simply used 1 thinking it was small enough not to matter.

I will need to make a corresponding change in the CVS version so that it will get into the next release. I'll do that this evening.

Sorry about this, but that patch doesn't seem to work. When I open the eps files generated with this change implimented, I get the artifact problem mentioned in the comment; fine lines at the boundaries of the contouring engine's subdomains. In fact, I get the artifacts at linewidths as large as 0.5.

Jordan

Jordan,

Strange, I did test the change and it worked fine with your example on my system. I will email you the result in a separate message so as not to clog the list. Then you can tell me if you see the problem in that file. Maybe I am misunderstanding something.

Eric

Jordan Dawe wrote:

···

Eric Firing wrote:

Jordan,

Thanks, now I see the problem and where it is coming from. In contour.py, near the bottom, in the contourf method, change the linewidth from 1 to 0.01, so the line reads:
            col = PolyCollection(nlist, linewidths=(0.01,))

I think this will be OK; based on the comment below the line, I think I found that using a linewidth of zero was problematic, so I probably simply used 1 thinking it was small enough not to matter.

I will need to make a corresponding change in the CVS version so that it will get into the next release. I'll do that this evening.

Sorry about this, but that patch doesn't seem to work. When I open the eps files generated with this change implimented, I get the artifact problem mentioned in the comment; fine lines at the boundaries of the contouring engine's subdomains. In fact, I get the artifacts at linewidths as large as 0.5.

Jordan

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit Understanding middleware for more information
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Jordan,

I have looked into various aspects of the problem you reported. It seems to be essentially a problem with antialiasing; all artifacts go away in the AGG backend with antialiasing turned off, regardless of the linewidth, right down to zero. With antialiasing on, however, it seems that a linewidth of about 0.5 with AGG (on my machine, with everything default) is needed to prevent the antialiasing from leaving light lines at polygon boundaries, regardless of whether they are the straight boundaries caused by chunking or the curved boundaries of the contours themselves. With Postscript, as rendered by ghostscript via gv, I see artifacts only with a much smaller linewidth, and only at some magnifications. Your ps viewers may be doing more antialiasing, and therefore showing artifacts over a larger range of linewidths. There is probably more going on, and more to be understood, but this got me far enough to manage the problem for now.

It looks like there is no problem with simply turning off the chunking. I have made a bunch of changes in CVS, including turning off the chunking by default, and allowing one to specify chunking, antialiasing, and linewidth explicitly for contourf. So, I think you will find that if you use the CVS version, the problems you reported will go away. If you haven't done it before, you will find that downloading and installing from CVS is very quick and easy; instructions are given on the sourceforge download site. (As John notes, there may be a lag between developer CVS and the mirrors; make sure that what you download includes my changes, committed a few minutes ago.) Alternatively, if you simply want to turn off chunking in 0.84, you can do it by editing cntr.c, approximately line 1384, change

     long nchunk = 30; /* hardwired for now */
to
     long nchunk = 0; /* hardwired for now */

and recompile/reinstall.

If you use the CVS version (or the next mpl release, whenever that comes out), note that the APIs for contour, contourf, and clabel have changed as described in API_CHANGES and as illustrated in examples/contour_demo.py and contourf_demo.py.

Eric

Jordan Dawe wrote:

···

Eric Firing wrote:

Jordan,

Thanks, now I see the problem and where it is coming from. In contour.py, near the bottom, in the contourf method, change the linewidth from 1 to 0.01, so the line reads:
            col = PolyCollection(nlist, linewidths=(0.01,))

I think this will be OK; based on the comment below the line, I think I found that using a linewidth of zero was problematic, so I probably simply used 1 thinking it was small enough not to matter.

I will need to make a corresponding change in the CVS version so that it will get into the next release. I'll do that this evening.

Sorry about this, but that patch doesn't seem to work. When I open the eps files generated with this change implimented, I get the artifact problem mentioned in the comment; fine lines at the boundaries of the contouring engine's subdomains. In fact, I get the artifacts at linewidths as large as 0.5.

Jordan

It looks like there is no problem with simply turning off the chunking. I have made a bunch of changes in CVS, including turning off the chunking by default, and allowing one to specify chunking, antialiasing, and linewidth explicitly for contourf. So, I think you will find that if you use the CVS version, the problems you reported will go away. If you haven't done it before, you will find that downloading and installing from CVS is very quick and easy; instructions are given on the sourceforge download site.

Sweet, will do. I am using the CVS version currently; I just submitted a patch to the sourceforge page to make it easier for me to compile, since I am running under cygwin most of the time. I have a couple of other patches I intend to submit when I have a spare moment; is the sourceforge page the proper place to do that?

Jordan