My favorites | Sign in
Project Logo
Project hosting will be READ-ONLY Wednesday at 8am PST due to brief network maintenance.
                
People details
Project owners:
  jpivarski
Project committers:
jim.belk, pivarski, tw-pub...@gmx.de

SVGFig (pronounced svig-fig)

The SVGFig package lets you draw mathematical figures in Scalable Vector Graphics format (SVG), using the Python language.

As a tool, its usefulness lies somewhere between freehand drawing programs, which don't give you quantitative control over your figures, and traditional plotting packages, which fit your data into a prescribed template. SVGFig allows you to draw anything you can express in Python.

SVGFig is particularly suited to handle non-linear geometries. All lines, including the coordinate axis, curve if passed through a non-linear coordinate transformation, and coordinate systems can be nested in trees. This generalizes all the tools necessary for making plots, so it is easy to create polar plots of radial data, Hammer-Aitoff projections of the sky, translations in hyperbolic spaces, or experiment with new representations.

SVGFig also maintains a convenient representation of SVG images as Python constructs, so you can load graphics from SVG files, dissect them, manipulate them with an automated script, and save them in batch.

System Requirements

Basic Idea

SVGFig defines two classes, SVG and Fig.

Examples

See the Example Gallery to get an idea of what SVGFig can do.

History

This product has been in development for over five years. As a graduate student in physics, I liked to make plots in Mathematica, because it provides access to the underlying primitives. It has limitations, however, in scope, syntax, and licencing.

At first I tried to find a similar open-source product in the Python language. PyX comes close: you can draw anything, including curved coordinate axes, but the syntax is lengthy, which is a liability in the heat of intense data analysis. It also spawns an external LaTeX process to draw text, which lead to synchronization issues when I mistyped LaTeX commands.

I wrote several wrappers of PyX and matplotlib before admitting that I needed to create a new product. The first version, called Plothon (the Barbarion!), drew primitives using GTK+ (9000 lines). I hadn't thought carefully enough about the overall structure, so the result wasn't much better than existing plotting packages.

Inspired the beautiful idea of generic, nested coordinates systems, I re-wrote the whole project, this time in QT (11000 lines). Unfortunately, this version became mired in excessive type-checking, which led to recursive loops and random crashes.

Realizing that simplicity is key, I re-wrote everything again, relying on SVG to encode the graphics (4000 lines). In the process of development, this SVG-based version became a little messy and overstructured, so I purified it, maintaining functionality. The present version, renamed SVGFig, is only 2300 lines.

Now it's done. It's beautiful! Enjoy it!

Update: after some brainstorming sessions with Jim B. months ago, we came up with an improved structure for the project. I finally put these ideas together into a 2.0.0alpha2 version that you can read about in Version2Announcement. As the name implies, it is neither complete nor guaranteed to be bug-free, but if you're interested in contributing, I would love the help! All you need is a Google/GMail account (and send me an e-mail).









Hosted by Google Code