From: Eric F. <ef...@ha...> - 2008-04-28 01:43:45
|
John Hunter wrote: > 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. I went ahead and committed an alternative fix that I think is cleaner, and greatly reduces the number of needless gsave/grestore pairs. Your version of the method is still there, with a mangled name, for easy reference and testing until we are sure which way to go. Sorry for whatever duplicated effort there has been. I did not intend to spend a fair chunk of the day working on this, but I let myself get sucked in. It was a challenge. As mentioned in a message a few minutes ago that I don't think went to the list, my gs interpreter is choking on the apostrophe (single quote) character, as in title or label strings. I can't find any reason why this should cause trouble--maybe it is a particular version or configuration of gs. Eric |