From: John H. <jdh...@ac...> - 2004-09-24 22:49:08
|
>>>>> "Daniel" == Daniel Ferreira <da...@te...> writes: Daniel> Hi, I'm learning how to use matplotlib and I'm having a Daniel> problem with show(). I did the simplest example of the Daniel> Tutorial on the Matplotlib's homepage: Daniel> from matplotlib.matlab import * plot([1,2,3,4]) show() Daniel> It works fine, but when I try to run it again (second time Daniel> on the same session), the plot is not shown. I have Daniel> another question too: when I run the show() command, my Daniel> program stops and only continues when I close the plot Daniel> windows. Is there anyway of show the plot and continues Daniel> the program with the plot window openned? Daniel> I'm using matplotlib 0.64.4-1 on a Debian GNU/Linux. Is this the right version number? I didn't know matplotlib 0.64 was out yet :-) Daniel> Sorry about my poor english. I didn't even notice - it's not that poor! The usage of show is a source of confusion to all new users of matplotlib -- you are not alone. Please see the FAQ http://matplotlib.sf.net/faq.html#SHOW. The main idea is that show is only meant to be used in matplotlib scripts, not interactively from the python shell. If working interactively (type some commands, look at a figure, type some more commands), you need to set interactive to be True in your rc file. Once you have done this (and restarted python) you won't need to call show at all in an interactive session. See also http://matplotlib.sf.net/interactive.html and http://matplotlib.sf.net/.matplotlibrc. I will try and update the tutorial to make this clearer. For interactive work, I also recommend you set your backend to TkAgg in your .matplotlibrc file. Or use ipython with the pylab option - google for matplotlib and ipython. Hope this helps, JDH |