CVS - rendering diagonal lines

I just noticed that the following script generates a

    > diagonal line that looks like it was drawn with a really
    > unsteady hand:

    > from pylab import frange, plot, show
    > plot(frange(-1,1,.01)*1e10) show()

    > The problem is not noticable for a small number of points,
    > such as plot(frange(-1,1,.5)*1e10). I tried clearing
    > site-packages, rebuilt MPL-0.80, the problem appears to be
    > in CVS.

w/o testing, I'll hazard a guess that this is due to a workaround I
have never been able to figure out with how agg does subpixel

Try commenting out these lines in _backend_agg.cpp in the draw_lines

    thisx = (int)thisx + 0.5;
    thisy = (int)thisy + 0.5;

These lines snap all the x and y points to pixel centers. If you
don't use pixel centers, agg will draw lines of different widths and
heights depending on the subpixel fraction. This is only apparent for
vertical and horizontal lines, generally, but is glaring for ticks and
grid lines. In the past, I've added a hack to only do snap to pixel
for horizontal and vertical lines with 2 points, which fixes the
special case problems of ticks and grids

I raised this issue with Maxim on the agg mailing list

and he responded by writing this page

which I still haven't been able to digest sufficiently in a way that
fixes this problem generally.

I reinstated in CVS a temporary hack which only does the snapto pixel
trick for len(2) lines. Should work well for most use cases. Give it
a try.