|
From: Friedrich H. <fri...@gm...> - 2008-06-02 12:02:43
|
Hello,
when I create an arrow with
>>> from pylab import *
>>> subplot(111)
>>> arrow(.5, .5, -.05, .02, lw=5, width=.01)
>>> savefig('foo.pdf')
and view it with
% xpdf foo.pdf
then I see on the startpoint an ugly pike. With gv and evince everything
is ok.
Any idea how to fix it in mpl? Because I dont want to switch to an other
viewer then xpdf.
Thanks,
Friedrich
|
|
From: Jouni K. S. <jk...@ik...> - 2008-06-02 12:12:33
|
Friedrich Hagedorn <fri...@gm...> writes: > % xpdf foo.pdf > > then I see on the startpoint an ugly pike. With gv and evince > everything is ok. Just to be sure about what the problem is, could you show us a screenshot of the ugly rendering, and another of a better rendering in another viewer? I think the list doesn't accept attachments, so it would be best if you could put the files somewhere on the web and send a link to the list or, failing that, send the screenshots to me by email. Also, what exact version of xpdf are you using? -- Jouni K. Seppänen http://www.iki.fi/jks |
|
From: Friedrich H. <fri...@gm...> - 2008-06-02 12:19:56
Attachments:
arrow-xpdf.png
arrow-evince.png
|
On Mon, Jun 02, 2008 at 03:12:19PM +0300, Jouni K. Seppänen wrote: > Friedrich Hagedorn <fri...@gm...> writes: > > > % xpdf foo.pdf > > > > then I see on the startpoint an ugly pike. With gv and evince > > everything is ok. > > Just to be sure about what the problem is, could you show us a > screenshot of the ugly rendering, and another of a better rendering in > another viewer? I think the list doesn't accept attachments, so it would > be best if you could put the files somewhere on the web and send a link > to the list or, failing that, send the screenshots to me by email. I try it. > Also, what exact version of xpdf are you using? xpdf version 3.02 Thanks, Friedrich |
|
From: Jouni K. S. <jk...@ik...> - 2008-06-02 20:18:04
|
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
|
|
From: Friedrich H. <fri...@gm...> - 2008-06-03 09:49:48
|
On Mon, Jun 02, 2008 at 11:17:44PM +0300, Jouni K. Seppänen wrote: > 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 |
|
From: Jouni K. S. <jk...@ik...> - 2008-09-07 11:29:46
|
I finally committed this fix. -- Jouni K. Seppänen http://www.iki.fi/jks |