File: test_timeaxis.py

package info (click to toggle)
pyx3 0.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: python: 27,656; makefile: 225; ansic: 130; sh: 17
file content (22 lines) | stat: -rwxr-xr-x 1,018 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python
import sys; sys.path[:0] = ["../.."]

import time, datetime
from pyx import *
from pyx.graph.axis import timeaxis
from pyx.graph import data

d = data.file("data/timedata", date=1, value=2)
d = data.points([[datetime.datetime(*(time.strptime(date)[:6])), value] for date, value in zip(d.columns["date"], d.columns["value"])], x=1, y=2)

g = graph.graphxy(height=5, x=timeaxis.timeaxis(manualticks=[timeaxis.timetick(2003, 8, 12),
                                                             timeaxis.timetick(2003, 8, 13),
                                                             timeaxis.timetick(2003, 8, 14),
                                                             timeaxis.timetick(2003, 8, 15),
                                                             timeaxis.timetick(2003, 8, 16)],
                                                texter=timeaxis.timetexter("%d %b")))
g.plot(d)
g.writeEPSfile("test_timeaxis")
g.writePDFfile("test_timeaxis")
g.writeSVGfile("test_timeaxis")