simpleSVG |
A Python program to produce SVG graphics. Version 0.20 is new on June 22, 2011. Works with Python 2.4, 2.6 and 3.1. |
SVG is a vector graphics format. I confess here that when I first heard of the term "vector graphics", I thought it was referring to plots with lots of little arrows. Nope, that is not what it means! Here are some definitions of "vector graphics".
simpleSVG is intended to replace vplot, which produced postscript graphics. Like vplot, simpleSVG is intended to simplify the use of graphics primitives, to make nonstandard plots that are not available in traditional plotting programs.
import simpleSVG a=simpleSVG.svg_class() a.scale() a.circle(.5,.5,100,fill='red',stroke='none') a.rect2(0., .15, 1., .85) a.close() ^D
You will produce a file temp.svg, which can be viewed with eog or inkview. (For viewing only, inkview is faster than the view/editor inkscape).
Another test is to simply execute the module simpleSVG.py, which by default runs an enclosed test program at end of the module. One of the best ways to learn how to uses simpleSVG.py is to study the test program at the end of simpleSVG.py. You can run the program with:
python3 simpleSVG.pyThe following SVG graphics, testSVG.svg, is produced: