views:

1490

answers:

7

I have a large data set of tuples containing (time of event, latitude, longitude) that I need to visualize. I was hoping to generate a 'movie'-like xy-plot, but was wondering if anyone has a better idea or if there is an easy way to do this in Python?

Thanks in advance for the help, --Leo

+15  A: 

get matplotlib

Francis
I thought that only made static plots. Is there a way to make movies out of a series of plots?
I'm not sure if this is a close enough to what you're looking for, but <a href="http://eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis/">these examples</a> gives you a constantly-updating rendering in a wx frame.I suspect it would be helpful to know what kind of animated output you're looking for, exactly.
esm
Erm, not sure what happened to that link. Try this one:http://eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis/
esm
you can also make a movie out of a series of plots using something like mencoder.
Autoplectic
A: 

I have had reasonable success with Python applications generating SVG with animation features embedded, but this was with a smaller set of elements than what you probably have. For example, if your data is about a seismic event, show a circle that shows up when the event happened and grows in size matching the magnitude of the event. A moving indicator over a timeline is really simple to add.

Kaleidoscope (Opera, others maybe, Safari not) shows lots of pieces moving around and I found inspirational. Lots of other good SVG tutorial content on the site too.

Joel
A: 

You might want to look at PyQwt. It's a plotting library which works with Qt/PyQt.

Several of the PyQwt examples (in the qt4examples directory) show how to create "moving" / dynamically changing plots -- look at CPUplot.py, MapDemo.py, DataDemo.py.

dF
PyQwt is nice but it gave me so much (compilation) troubles on Windows and Mac that I ended up using matplotlib
Luper Rouch
+4  A: 

I'd try rpy. All the power of R, from within python. http://rpy.sourceforge.net/

rpy is awesome.

Check out the CRAN library for animations, http://cran.r-project.org/web/packages/animation/index.html

Of course, you have to learn a bit about R to do this, but if you're planning to do this kind of thing routinely in future it will be well worth your while to learn.

blackkettle
+2  A: 

Enthought's Chaco is designed for interactive/updating plots. the api and such takes a little while to get use to, but once you're there it's a fantastic framework to work with.

Autoplectic
+2  A: 

If you are interested in scientific plotting using Python then have a look at Mlab: http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab.html

It allows you to plot 2d / 3d and animate your data and the quality of the charts is really high.

DrDee
+8  A: 

The easiest option is matplotlib. Two particular solutions that might work for you are:

1) You can generate a series of plots, each a snapshot at a given time. These can either be displayed as a dynamic plot in matplotlib, where the axes stay the same and the data moves around; or you can save the series of plots to separate files and later combine them to make a movie (using a separate application). There a number of examples in the official examples for doing these things.

2) A simple scatter plot, where the colors of the circles changes with time might work well for your data. This is super easy. See this, for example, which produces this figure alt text

tom10