Tools: Matplotlib for Python


When it comes to doing graphs, Matplotlib is the one to use. It's an open source library that does a wonderful job of creating graphs. As you can see above it also does a good job with anti-aliasing the lines (this is zoomed in from a black and white graph I did for my wife). The site has a lot more samples which show the features of the library. I was able to create a figure with six graphs in about 10 minutes, without ever having used the library before (just copied from the examples). To get all the little text elements and adjustments took a bit longer, but it is still impressive how quickly you can get going.
In a few lines you can output the graph to the screen using either Tkinker, wxPython, or GTK and have it interactive as well (zoomin, etc.). You can also output to PNG, JPG, SVG, PS and other output formats.
The anti-aliasing is done so well because Matplotlib uses the Anti-Grain Geometry library which can do sub-pixel anti-aliasing of lines (check it out).
Matplotlib requires (Numarray or numeric) which is a great library for Python to handle large matrices. In a few lines I was able to load in Renata's raw data, perform some averaging and standard deviations and plot the results in six graphs. Before she used Excel to do the calculations and her workbook and 45 sheets in it. The graphs that Excel produced were not of high enough quality so she used Sigmaplot to graph them. Now everything is done in one python program.

Comments

Popular posts from this blog

Shortest Sudoku solver in Python

Dot to Png

Seven Segment Display in Inkscape