I've been rewriting the Arrow class in patches.py to improve
> the look of quiver plots and am getting generally good
> results. The problems with current quiver plots are that
> arrows representing very small values are scaled along their
> length but not in width and also that arrowheads are not of
> a constant size. I have addressed both of these problems and
> getting results much more like Matlab quiver plots
> now. However, now that I am scaling arrow patches down to
> very small sizes, I see weird shaped arrows at some zoom
> levels but when I zoom in close enough to see the shape
> properly they look nicely formed. Is there a known problem,
> perhaps with Agg doing some fancy truncation in order to
> achieve good speed, where patches are distorted if their
> vertices are very close together at a particular
> magnification? I can provide code and graphic examples if it
> would help.
My guess is that this has something to do with subpixel rendering, and
it has cropped up in a number of circumstances. Unfortunately, I
don't know of an easy answer. If you tell agg to draw a line from 0,0
to 1,1, the line will look different than a line from .5,.5 to 1.5,1.5
See
http://antigrain.com/tips/line_alignment/line_alignment.agdoc.html#PAGE_LINE_ALIGNMENT
One way to confirm that this is your problem is to turn antialiasing
off
patch.set_antialiased(False)
but I just noticed that the agg draw_polygon method does not respect
the aa setting, so I just committed changes to svn to fix this. Do
you have access to svn?
With svn in the example below, the green polygon should look more
jaggy than the yellow one. My guess is that this weirdness for small
arrows will go away with antialiasing off, but then you will have
crappy, aliased arrows. Not sure what the right answer is...
from matplotlib.patches import RegularPolygon
from pylab import figure, show
p1 = RegularPolygon((1,1), 5, antialiased=True, facecolor='yellow', linewidth=5)
p2 = RegularPolygon((0,0), 5, antialiased=False, facecolor='green', linewidth=5, alpha=0.5)
fig = figure()
ax = fig.add_subplot(111, xlim=(-6,6), ylim=(-6,6), autoscale_on=False)
ax.add_patch(p1)
ax.add_patch(p2)
show()
JDH