ugly arrow with xpdf

I can confirm this in at least version 0.91.3. The problem seems to be
caused by the midpoint of the stem being included in the path twice in a
row. The following patch removes the midpoint altogether and fixes the
rendering problem at least on my version of xpdf. I'm kind of swamped
right now, so I hope someone else can check whether this breaks any
other uses of arrows, or some other backend. (If this doesn't seem to
happen, please file a bug report in the tracker so it isn't forgotten.)
The patch is against the maintenance branch, but the trunk has
similar-looking code.

Index: lib/matplotlib/patches.py

···

===================================================================
--- lib/matplotlib/patches.py (revision 5366)
+++ lib/matplotlib/patches.py (working copy)
@@ -634,7 +634,13 @@
                 if shape == 'right':
                     coords = right_half_arrow
                 elif shape == 'full':
- coords=npy.concatenate([left_half_arrow,right_half_arrow[::-1]])
+ # Concatenating the full paths caused the midpoint
+ # of the stem to be included twice, which was
+ # rendered badly by xpdf. Since the point is right
+ # between the corners of the stem, we can drop it
+ # from both halves.
+ coords=npy.concatenate([left_half_arrow[:-1],
+ right_half_arrow[-2::-1]])
                 else:
                     raise ValueError, "Got unknown shape: %s" % shape
             cx = float(dx)/distance

--
Jouni K. Sepp�nen
http://www.iki.fi/jks

I can confirm this in at least version 0.91.3. The problem seems to be
caused by the midpoint of the stem being included in the path twice in a
row. The following patch removes the midpoint altogether and fixes the
rendering problem at least on my version of xpdf. I'm kind of swamped
right now, so I hope someone else can check whether this breaks any
other uses of arrows, or some other backend. (If this doesn't seem to
happen, please file a bug report in the tracker so it isn't forgotten.)
The patch is against the maintenance branch, but the trunk has
similar-looking code.

Thank you very much. It works for me too.

Index: lib/matplotlib/patches.py

--- lib/matplotlib/patches.py (revision 5366)
+++ lib/matplotlib/patches.py (working copy)
@@ -634,7 +634,13 @@
                 if shape == 'right':
                     coords = right_half_arrow
                 elif shape == 'full':
- coords=npy.concatenate([left_half_arrow,right_half_arrow[::-1]])
+ # Concatenating the full paths caused the midpoint
+ # of the stem to be included twice, which was
+ # rendered badly by xpdf. Since the point is right
+ # between the corners of the stem, we can drop it
+ # from both halves.
+ coords=npy.concatenate([left_half_arrow[:-1],

for the most recent svn version: npy => np

+ right_half_arrow[-2::-1]])
                 else:
                     raise ValueError, "Got unknown shape: %s" % shape
             cx = float(dx)/distance

By,

  Friedrich

···

On Mon, Jun 02, 2008 at 11:17:44PM +0300, Jouni K. Sepp�nen wrote: