graph style + data reorganization completed
[PyX/mjg.git] / test / functional / test_timeaxis.py
blob40ed5195187412896b5e4b8c0f129e739913ba6d
1 #!/usr/bin/env python
2 import sys; sys.path[:0] = ["../.."]
4 try:
5 import datetime
6 except:
7 print "datetime import failed (needs python 2.3+) -> test skiped"
8 else:
9 import time
10 from pyx import *
11 from pyx.graph.axis import timeaxis
12 from pyx.graph import data
14 d = data.file("data/timedata", date=1, value=2)
15 d = data.list([[datetime.datetime(*(time.strptime(date)[:6])), value] for date, value in zip(d.getcolumn("date"), d.getcolumn("value"))], x=1, y=2)
17 g = graph.graphxy(height=5, x=timeaxis.timeaxis(manualticks=[timeaxis.timetick(2003, 8, 12),
18 timeaxis.timetick(2003, 8, 13),
19 timeaxis.timetick(2003, 8, 14),
20 timeaxis.timetick(2003, 8, 15),
21 timeaxis.timetick(2003, 8, 16)],
22 texter=timeaxis.timetexter("%d %b")))
23 g.plot(d)
24 g.writeEPSfile("test_timeaxis")