views:

3262

answers:

8
+5  A: 

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

Hank Gay
But it's not free for commercial use.
Dave Berk
+6  A: 

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

zweiterlinde
Although I've used this, and it works, I've always found matplotlib pretty clunky to work with. I prefer nearly any other graphing library over matplotlib.
Chris S
+7  A: 

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

vartec
I can just mention that after I used CairoPlot for a while I switched to PyChart which is much more configurable.
Zitrax
+5  A: 

pyCairo is an option worth looking at.

Ignacio Vazquez-Abrams
Not only can pycairo write to SVG. With a few lines of code changed, it can write the same data to either a PDF or a PNG. Very flexible.
pi
+5  A: 
Rodrigo
I ended up using this as I do not do anything more advanced. However I never managed to find how to get those small legends printed to the right, neither from trunk or in 1.1, you can get legends in a box though.
Zitrax
Yeah, the little legends on the right were removed on newer versions as they didn't work well for many values (as you can see above). The only option, nowadays, is to use the box on the right upper corner (available only on trunk version).
Rodrigo
+6  A: 

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.

J.F. Sebastian
While Graphviz is great, it is neither a general SVG solution nor does it address the specific requirement specified in the question. This answer seems like a non sequitur.
Laurence Gonsalves
@Laurence Gonsalves: Line plots are not the only type of diagrams http://images.google.com/images?q=diagram
J.F. Sebastian
The question specifically asked for "simple line graphs" and had an example that made it pretty clear to anyone that both read the question and has used Graphviz that Graphviz wouldn't be helpful to them. Like I said: Graphviz is great. I use it all the time. Recommending it here is like recommending a screwdriver to someone that wants to drive in nails, however.
Laurence Gonsalves
J.F. Sebastian
Case in point, I was looking for a way to generate graphs like what graphviz makes using Python, and I searched on Google and found this post. It seems to be exactly what I need, so thanks!
Ibrahim
+1  A: 

svgfig is worth a look:

http://code.google.com/p/svgfig/

Drew Wagner
A: 

svgfig looked like a more substantial project, mentioning several iterations, but the installer gave an error on mac os x. i'm working with pysvg now, will update later

Alejandro