Pretty graphs and charts in Python [closed]
What are the available libraries for creating pretty charts and graphs in a Python application?
I'm the one supporting CairoPlot and I'm very proud it came up here. Surely matplotlib is great, but I believe CairoPlot is better looking. So, for presentations and websites, it's a very good choice.
Today I released version 1.1. If interested, check it out at CairoPlot v1.1
EDIT: After a long and cold winter, CairoPlot is being developed again. Check out the new version on GitHub.
For interactive work, Matplotlib is the mature standard. It provides an OO-style API as well as a Matlab-style interactive API.
Chaco is a more modern plotting library from the folks at Enthought. It uses Enthought's Kiva vector drawing library and currently works only with Wx and Qt with OpenGL on the way (Matplotlib has backends for Tk, Qt, Wx, Cocoa, and many image types such as PDF, EPS, PNG, etc.). The main advantages of Chaco are its speed relative to Matplotlib and its integration with Enthought's Traits API for interactive applications.
You can also use pygooglechart, which uses the Google Chart API. This isn't something you'd always want to use, but if you want a small number of good, simple, charts, and are always online, and especially if you're displaying in a browser anyway, it's a good choice.
You didn't mention what output format you need but reportlab is good at creating charts both in pdf and bitmap (e.g. png) format.
Here is a simple example of a barchart in png and pdf format:
from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart
d = Drawing(300, 200)
chart = VerticalBarChart()
chart.width = 260
chart.height = 160
chart.x = 20
chart.y = 20
chart.data = [[1,2], [3,4]]
chart.categoryAxis.categoryNames = ['foo', 'bar']
chart.valueAxis.valueMin = 0
d.add(chart)
d.save(fnRoot='test', formats=['png', 'pdf'])
alt text http://i40.tinypic.com/2j677tl.jpg
Note: the image has been converted to jpg by the image host.
CairoPlot