svg diagrams using python

2020-02-17 06:59发布

I am looking for a library to generate svg diagrams in python (I fetch data from a sql database). I have found python-gd, but it has not much documentation and last update was in 2005 so I wonder if there are any other libraries that are good for this purpose.

I am mostly thinking about simple line graphs, something like this: example line graph

11条回答
我欲成王,谁敢阻挡
2楼-- · 2020-02-17 07:41

Try using matplotlib. You can configure it with a SVG backend.

查看更多
再贱就再见
3楼-- · 2020-02-17 07:44

2018 Update:

Plotly ( https://github.com/plotly/plotly.py / https://plot.ly/d3-js-for-python-and-pandas-charts/ ) is probably the most versatile solution. It is distributed under MIT license (free to use and reuse), although it include features that might not be compatible with some CMS with more restrictive security issues since it relies on JS, although options to export the diagrams as plain SVG are also available.

Pygal ( https://github.com/Kozea/pygal / http://pygal.org ) is simpler relies only on svg standard. As such it's results are more reusable under more restrict CMS systems. It is distributed under GNU license.

查看更多
对你真心纯属浪费
4楼-- · 2020-02-17 07:45

You can use Graphviz to generate diagrams in SVG format. There are Python bindings to Graphviz e.g., pydot -- Python interface to Graphviz's Dot language.

查看更多
老娘就宠你
5楼-- · 2020-02-17 07:46

Here's a general purpose SVG library in Python: pySVG.

查看更多
老娘就宠你
6楼-- · 2020-02-17 07:52

PyChart "is a Python library for creating high quality Encapsulated Postscript, PDF, PNG, or SVG charts."

查看更多
登录 后发表回答