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:
ReportLab has native support for generating SVGs, but not for embedding SVGs in their PDFs. Fortunately, Dinu Gherman created the svglib package, a pure-Python package that can read SVG files and convert them to other formats that ReportLab can use.
Svglib is a pure-Python library for reading SVG files and converting them (to a reasonable degree) to other formats using the ReportLab Open Source toolkit.
Pygal is a Python module that creates SVG (Scalable Vector Graphics) graphs/charts in a variety of styles. Pygal is highly customize-able, yet also extremely simplistic, which is a very rare combination. You can make line graphs, bar graphs, histograms, pie charts, maps, and a whole lot more.
Try using matplotlib. You can configure it with a SVG backend.
As you're looking for simple line graphics, probably, CairoPlot will fit your needs as it can generate svg output files out of the box. Take a look at this.
This example image shows only a few of its capabilities. Using the trunk version available at launchpad you'll be able to add a legend box and add axis titles.
Besides that, using the trunk version, it's possible to generate:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With