views:

12190

answers:

15

What are the best libraries for creating pretty charts and graphs in a Python application?

+4  A: 

Have you looked into ChartDirector for Python?

I can't speak about this one, but I've used ChartDirector for PHP and it's pretty good.

Thomas Owens
ChartDirector works well with Python. I used it regularly to produce multiline plots.
pwdyson
+2  A: 

NodeBox is awesome for raw graphics creation.

Mark Cidade
+5  A: 

CairoPlot

elmarco
Why is it good? Have you used it?
Nick
Yes, I used dot_line_plot() in reporting/stats tools. It's pretty and easy. See the top reponse from Rodrigo about Matplotlib and CairoPlot. I also use Matplotlib. In fact, I am using it right now.
elmarco
+2  A: 

Chaco from enthought is another option

Azim
+8  A: 

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.

Tony Meyer
A word of warning, the charts that Google allows you to create are rather limited in size (width * height <= 300,000 pixels). Also, Google Charts (not the Python API) will choke with even modestly sized data sets. Otherwise, they're great.
Pat Notz
A: 

You could also consider google charts.

Not technically a python API, but you can use it from python, it's reasonably fast to code for, and the results tend to look nice. If you happen to be using your plots online, then this would be an even better solution.

Tyler
+25  A: 

Hi there, 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

Rodrigo
Looks good, I'd like to try it. Any plan to make a windows installer for python 2.6?
monkut
+1 for a great lib, and thank you for your support yesterday (http://stackoverflow.com/questions/359727#516090)
VonC
No problem for the support, as I agree on it. Thanks for the compliment :D
Rodrigo
Just added http://stackoverflow.com/questions/359727#520049 for you to downvote, if you want.
VonC
Cairoplot really doesn't work that well for large amounts of data though (correct me if I'm wrong). You can't add labels to the axis to summarise the hlabels or vlabels. I can't see anyway to plot multiple lines on a graph or have any control over the colours used. I could hack away at the script... moving to matplotlib...
Jon
Everyone should disregard Jon's comment, its very easy to label axis and define the colors used...Check tests.py for examples. Anyways, Thanks for a nice lib.
Daniel T. Magnusson
+11  A: 

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.

Barry Wark
+3  A: 

You should also consider PyCha http://www.lorenzogil.com/projects/pycha/

Mayowa
+1  A: 

If you like to use gnuplot for plotting, you should consider Gnuplot.py. It provides an object-oriented interface to gnuplot, and also allows you to pass commands directly to gnuplot. Unfortunately, it is no longer being actively developed.

mhagger
A: 

PLplot is a cross-platform software package for creating scientific plots. They aren't very pretty (eye catching), but they look good enough. Have a look at some examples (both source code and pictures).

The PLplot core library can be used to create standard x-y plots, semi-log plots, log-log plots, contour plots, 3D surface plots, mesh plots, bar charts and pie charts. It runs on Windows (2000, XP and Vista), Linux, Mac OS X, and other Unices.

Cristian Ciupitu
+2  A: 

I am a fan on PyOFC2 : http://btbytes.github.com/pyofc2/

It just just a package that makes it easy to generate the JSON data needed for Open Flash Charts 2, which are very beautiful. Check out the examples on the link above.

Gourneau
+2  A: 
Serbaut
If get an exception "RenderPMError: Can't setFont(Times-Roman) missing the T1 files?" (like I got) on d.save in above code- Solution is to download and extract http://www.reportlab.org/ftp/fonts/pfbfer.zip in reportlabs/fornts directory
Shekhar
+2  A: 

I used pychart and thought it was very straightforward.

http://home.gna.org/pychart/

It's all native python and does not have a busload of dependencies. I'm sure matplotlib is lovely but I'd be downloading and installing for days and I just want one measley bar chart!

It doesn't seem to have been updated in a few years but hey it works!

tullaman
+1  A: 

Please look at the Open Flash Chart embedding for WHIFF http://aaron.oirt.rutgers.edu/myapp/docs/W1100_1600.openFlashCharts and the amCharts embedding for WHIFF too http://aaron.oirt.rutgers.edu/myapp/amcharts/doc. Thanks.

Aaron Watters