Hi,

On 09.03.06, Thomas Pohl wrote:
> Andre Wobst wrote:
> > Yes, of course we can properly calculate the bbox and do the correct
> > shift. I'm still -0. Maybe adding an option to writeEPSfile could get
> > a +0 from me, but making it the default is a clear -0. Maybe Jörg
> > wants to add some weight here ...
> 
> I totally agree: the default behavior should stay as it is now.
> Having an option in writeEPSfile to prevent negative boundary
> values would be handy, nevertheless.
> 
> Question to the developers:
> The same functionalty could be achieved by specifying an individual
> paper format which fits the values from canvas.bbox(), right?

Basically. Comming back to our original example you could do:

    from pyx import *
    g = graph.graphxy(width=10)
    g.plot(graph.data.function("y(x)=sin(x)", min=-1, max=1, points=1000))
    g.writeEPSfile("fig", paperformat=document.paperformat(g.bbox().width(), 
g.bbox().height()))

Note that this code is bad in that it leads to a multiple calculation
of the same bbox which is an time consuming operation (and it can't be
easily cached by the canvas).

Beside that you'll find that the bbox still is off by one (PostScript
point). This is due to the fact that we enlarge the bounding box
written into the PostScript file, since we don't take into account the
line widths and casps etc. in our bbox calculations. While this is not
perfect, it seems to be a common way of doing that.

Overall, if we want to add a positivebbox option in writeEPSfile, we
should do it not by using some strange paperformat.


André

-- 
by  _ _      _    Dr. André Wobst
   / \ \    / )   [EMAIL PROTECTED], http://www.wobsta.de/
  / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
 (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to