Scientific Plotting in Python
Asked Answered
D

7

8

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

Dilation answered 3/5, 2009 at 1:53 Comment(1)
such a general title ^^ good way to get 6k views and be automatically suggestedJohanson
D
16

get matplotlib

Duaneduarchy answered 3/5, 2009 at 2:14 Comment(5)
I thought that only made static plots. Is there a way to make movies out of a series of plots?Dilation
I'm not sure if this is a close enough to what you're looking for, but <a href="eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis/… 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.Lyso
Erm, not sure what happened to that link. Try this one: eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guisLyso
you can also make a movie out of a series of plots using something like mencoder.Vanadinite
plotly and dash are also coolJohanson
P
8

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 http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/ellipse_collection.hires.png

Pizzeria answered 1/6, 2009 at 20:17 Comment(0)
P
4

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.

Pricking answered 3/5, 2009 at 16:18 Comment(0)
S
3

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.

Swung answered 1/6, 2009 at 18:56 Comment(0)
V
2

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.

Vanadinite answered 3/5, 2009 at 16:46 Comment(0)
E
0

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.

Exertion answered 3/5, 2009 at 4:23 Comment(0)
V
0

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.

Venesection answered 3/5, 2009 at 5:6 Comment(1)
PyQwt is nice but it gave me so much (compilation) troubles on Windows and Mac that I ended up using matplotlibAglet

© 2022 - 2024 — McMap. All rights reserved.