[Tutor] two-dimensional color map

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


I'm so, so sorry! When editing my script before posting it, I accidently 
deleted a line activating matplotlib interactive mode. The correct listing is 
the one below.

Hello
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 *

ion()
# Display a random matrix with a specified figure number
for i in range(20):
    mymatrix = rand(864,864)
    fig = matshow(mymatrix,fignum=0)
    draw()
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/16ad488f/attachment.html>


More information about the Tutor mailing list