File: colorized_dots.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 (14 lines) | stat: -rw-r--r-- 320 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import random

import leather

dot_data = [(random.randint(0, 250), random.randint(0, 250)) for i in range(100)]


def colorizer(d):
    return 'rgb(%i, %i, %i)' % (d.x, d.y, 150)


chart = leather.Chart('Colorized dots')
chart.add_dots(dot_data, fill_color=colorizer)
chart.to_svg('examples/charts/colorized_dots.svg')