File: log.py

package info (click to toggle)
pyx 0.9-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,060 kB
  • ctags: 2,665
  • sloc: python: 15,205; makefile: 142; ansic: 131
file content (20 lines) | stat: -rw-r--r-- 823 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import math
from pyx import *
from pyx.graph import axis

p = path.curve(0, 0, 3, 0, 1, 4, 4, 4)

log2parter = axis.parter.log([axis.parter.preexp([axis.tick.rational(1)], 4),
                              axis.parter.preexp([axis.tick.rational(1)], 2)])
log2texter = axis.texter.exponential(nomantissaexp=r"{2^{%s}}",
                                     mantissamax=axis.tick.rational(2))

c = canvas.canvas()
c.insert(axis.pathaxis(p, axis.log(min=1, max=1024)))
c.insert(axis.pathaxis(p.transformed(trafo.translate(4, 0)),
                       axis.log(min=1, max=1024, parter=log2parter)))
c.insert(axis.pathaxis(p.transformed(trafo.translate(8, 0)),
                       axis.log(min=1, max=1024, parter=log2parter,
                                texter=log2texter)))
c.writeEPSfile("log")
c.writePDFfile("log")