File: tick_format.py

package info (click to toggle)
python-leather 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 652 kB
  • sloc: python: 2,385; makefile: 117; sh: 5
file content (18 lines) | stat: -rw-r--r-- 324 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import leather

data = [
    (0, 3),
    (4, 5),
    (7, 9),
    (8, 4)
]


def tick_formatter(value, index, tick_count):
    return '%i (%i/%i)' % (value, index, tick_count)


chart = leather.Chart('Line')
chart.add_x_axis(tick_formatter=tick_formatter)
chart.add_line(data)
chart.to_svg('examples/charts/tick_format.svg')