plotting problem

Hi All,

I have a slight problem using matplotlib 0.87.7. I’m using Ubuntu 6.10 and installed mpl from source. I’m running numpy 1.01, also installed from source.

If I run the script below, the first plot shows fine. When I close it the second plot should display but it doesn’t. I can only get the first plot to show. Thereafter the plot command doesn’t seem to work. I tried reinstalling matplotlib. That didn’t work. This works fine if I type it into ipython. It also works on my computer running FC5.

Any help will be greatly appreciated.

-Ewald

Sample script

from pylab import *
t = arange(10)
f = t*t
plot(t,f)
show()
plot(t,f)
show()

Hi All,

I have a slight problem using matplotlib 0.87.7. I'm using Ubuntu 6.10 and
installed mpl from source. I'm running numpy 1.01, also installed from
source.

If I run the script below, the first plot shows fine. When I close it the
second plot should display but it doesn't. I can only get the first plot to
show. Thereafter the plot command doesn't seem to work. I tried reinstalling
matplotlib. That didn't work. This works fine if I type it into ipython. It
also works on my computer running FC5.

Any help will be greatly appreciated.

-Ewald

# Sample script
from pylab import *
t = arange(10)
f = t*t
plot(t,f)
show()
plot(t,f)
show()

Ewald,

It may be that what you are trying should work.

However, I believe that for interactive work it is recommended to use
ipython -pylab unless you are using the TkAgg backend. You select
this in your matplotlibrc file (it should go into ~/.matplotlib)
OR
(see http://matplotlib.sourceforge.net/faq.html) you can do the use
command before importing pylab, as described at
http://matplotlib.sourceforge.net/backends.html

  >>> import matplotlib
  >>> matplotlib.use('TkAgg')
  >>> from pylab import *

Note that if you are using an IDE like pycrust, ipython -pylab,
pythonwin, or IDLE, pylab may have already been loaded, and subsequent
calls to use or from pylab import * will have no effect unless you
explicitly force a module reload.

HTH. George Nurser.

···

On 14/02/07, Ewald Zietsman <ewald.zietsman@...287...> wrote:

What Ewald is trying to do used to work. The idea is not to work
interactively, but to run a script and have the plots render in stages, the
next stage begins when the current windows are closed. I know we have users
who take advantage of this behavior for presentations.

Darren

···

On Wednesday 14 February 2007 6:59:18 am George Nurser wrote:

On 14/02/07, Ewald Zietsman <ewald.zietsman@...287...> wrote:
> Hi All,
>
> I have a slight problem using matplotlib 0.87.7. I'm using Ubuntu 6.10
> and installed mpl from source. I'm running numpy 1.01, also installed
> from source.
>
> If I run the script below, the first plot shows fine. When I close it the
> second plot should display but it doesn't. I can only get the first plot
> to show. Thereafter the plot command doesn't seem to work. I tried
> reinstalling matplotlib. That didn't work. This works fine if I type it
> into ipython. It also works on my computer running FC5.
>
> Any help will be greatly appreciated.
>
> -Ewald
>
> # Sample script
> from pylab import *
> t = arange(10)
> f = t*t
> plot(t,f)
> show()
> plot(t,f)
> show()

Ewald,

It may be that what you are trying should work.

However, I believe that for interactive work it is recommended to use
ipython -pylab unless you are using the TkAgg backend.

This was always an unsupported use of show. The FAQ entry

  http://matplotlib.sourceforge.net/faq.html#SHOW

states in bold:

  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 instead.

That is worked in some cases can be considered an accident of the
backend and possibly GUI version.

That said, I would like to support this use case, essentially a pause
until some user input is given. Lots of people want it and it is a
useful thing. This came up again back in October. Nadia at STScI
worked on this and I think she thought she had a solution for blocking
calls in a threaded environment. Maybe she can provide some input
here.

JDH

···

On 2/14/07, Darren Dale <dd55@...163...> wrote:

What Ewald is trying to do used to work. The idea is not to work
interactively, but to run a script and have the plots render in stages, the
next stage begins when the current windows are closed. I know we have users
who take advantage of this behavior for presentations.