[Tutor] two-dimensional color map

Jose Amoreira ljmamoreira at gmail.com
Thu Feb 9 16:36:15 CET 2012

I'm trying to plot a false-color map of a two dimensional function. My main 
problem is that the function I want to plot depends also on time, and I wish 
to show the plot as the function evolves, in real time. My first (and only, so 
far) idea on how to achieve this was to iterate the computation and the plot 
of the values of the function on a 2-D mesh for different times.

Regarding the plot, I tried some options and the one that came closer to what 
I pretend is based on pylab (numpy and matplotlib, I guess), using the 
matshow() method. However, I found that the display of successive frames takes 
longer and longer. The following simple script shows this behaviour:
from matplotlib.pylab import *

# Display a random matrix with a specified figure number
for i in range(20):
    mymatrix = rand(864,864)
    fig = matshow(mymatrix,fignum=0)
quit = raw_input()  #wait for user input before closing graphics window

So my questions are
1. Is matshow() appropriate for what I have in mind?
2. Am I using it correctly?
3. Are there better tools for plotting time-dependent 2D data using python?

Thank you very much
Ze Amoreira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120209/93c5e500/attachment.html>

More information about the Tutor mailing list