Emmanuel Favre-Nicolin wrote:
> Hi,
>
> I can plot only one time in windows. The second time, the window
> appears without the tools and when I click on the windows it become
> white and freezes. Here is a code :
>
> from pylab import *
> x=arange(5)
> y=x*x
> plot(x,y)
> show()
> plot(x,y)
> show()
Emmanuel:
Quoting from the the FAQ (http://matplotlib.sourceforge.net/faq.html):
" It is possible to force matplotlib to draw after every command, which
is what you want in interactive mode
<http://matplotlib.sourceforge.net/interactive.html>, but in a script
you want to defer all drawing until the script has executed. This is
especially important for complex figures that take some time to draw.
'show' is designed to tell matplotlib that you're all done issuing
commands and you want to draw the figure now. In the TkAgg backend,
which can be used from an arbitrary python shell interactively, it also
sets interactive mode. So you can launch your script with python -i
myscript.py -dTkAgg and then change it interactively from the shell.
IMPORTANT: show should called at most once per script and it should be
the last line of your script. At that point, the GUI takes control of
the interpreter. If you want to force a figure draw, use draw
<http://matplotlib.sourceforge.net/matplotlib.pylab.html#-draw> instead."
-Jeff
--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328