понеділок, 22 грудня 2014 р.

Graph statistic with Pygal

In this lesson I will show you how to use Pygal python library. This library can be used for demonstrating of any statistics and so on. Installation is easy as usual:

# pip install pygal

For correct work and importing svg to png you need to install such libs too:

# pip install -U lxml cairosvg tinycss cssselect

Lets go! This is first trivial example:



Save and launch this script and you can see two images: one why.svg and second why.png. First one you can open with any browser and embed in web-pages as well.

Maybe you begin to thing that pygal can draw only circle diagram but no. This code will draw horizontal bar diagram:




Pygal is awesome lib for drawing diagrams. Many different examples you can find at http://pygal.org/chart_types/

Links:
http://pygal.org
http://stackoverflow.com/questions/24476029/pygal-rendering-png-svg-black-pictures
http://stackoverflow.com/questions/6589358/convert-svg-to-png-in-python

Немає коментарів:

Дописати коментар