Salut Michael, > But, I was also curious how to implement this. The following dirty > trick overwrites the modulo function of the default strings. I took > the log.py example as a base, never mind the curved axis. This might be a good opportunity to make use of the units-package. Your example then becomes
------------------------------------------------------------
import math
from pyx import *
from pyx.graph import axis
text.set(mode="latex")
text.preamble(r"\usepackage{units}")
class mystr(str):
prefixes = [
(3, "M"),
(0, ""),
(-1, "d"),
(-2, "c"),
(-3, "m"),
(-6, r"\mu{}"),
(-9, "n"),
(-12, "p"),
(-15, "f"),
(-18, "a")]
def __mod__(self, otherstr):
other = int(otherstr)
for expon, pref in self.prefixes:
if other >= expon:
break
o, p = other, pref
return r"\unit[%d]{%sT}" % (10**(other-expon), pref)
p = path.curve(0, 0, 3, 0, 1, 4, 4, 4)
mytexter = axis.texter.exponential(nomantissaexp=mystr())
c = canvas.canvas()
c.insert(axis.pathaxis(p, axis.log(min=1e-16, max=1, texter=mytexter)))
c.writeEPSfile("log")
c.writePDFfile("log")
------------------------------------------------------------
Best regards,
Gert
--
Gert-Ludwig Ingold email: [EMAIL PROTECTED]
Institut für Physik Phone: +49-821-598-3234
Universität Augsburg Fax : +49-821-598-3222
D-86135 Augsburg WWW : www.physik.uni-augsburg.de/theo1/ingold
Germany PGP : 86FF5A93, key available from homepage
pgpWkwgG2Eqmr.pgp
Description: PGP signature
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
