SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] dpi-related positioning errors in Agg savefig

From: John H. <jd...@gm...> - 2008年04月28日 01:29:01
On Sun, Apr 27, 2008 at 12:56 PM, Eric Firing <ef...@ha...> wrote:
> The plot thickens. The postscript backend is completely confused by the
> quiver plot. Try the attached example.
Argg, that was a subtle one -- there was a bug in backend ps which was
exposed only if you are using a path collection with offsets,
transoffset and clippath and cliprect both None. In that scenario,
the translate in the bind def function was not getting wrapped in a
gsave/grestore pair, which was causing the axes to be drawn in the
wrong place because the translate from the offset remained in effect.
I tried following the draw_markers logic and putting the
gsave/grestore in the ps_cmd, eg in draw_markers Michael writes ijn a
comment:
 ps_cmd = ['/o {', 'gsave', 'newpath', 'translate'] # dont want
the translate to be global
so clearly he was bumping up against the same problem with markers.
For some reason, trying the same thing in the path_collection was not
working for me, so I resorted to the somewhat hackish approach of
forcing _draw_ps to wrap a gsave/grestore if it wasn't getting one
from the cliprect or clippath:
 needwrap = not (clippath or cliprect)
 if needwrap:
 # we need to make sure that there is at least 1
 # save/grestore around each ps write so we'll force it if
 # we're not getting one from the cliprecot or clippath.
 # hackish, yes
 write('gsave\n')
and then
 if needwrap:
 write('grestore\n')
I think there will be cleaner way, but it will need some fresh
eyeballs tomorrow and this will provide a temporary fix.
JDH

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /