IPython interactivity gone with 0.80?

Hi, I just upgraded to 0.80 from 0.73.1 on a Fedora Core 3

    > machine. I am (and have been) using ipython 0.6.13 as my
    > shell. After the upgrade, plots from scripts are no longer
    > interactive - I need an explicit call to pylab.show() to
    > show the plots.

    > Do I need to update some settings? I am using the GTKAgg
    > backend with all default parameters (no user-specific
    > .matplotlibrc) and I compiled matplotlib from sources. Here
    > is a simple script that no longer updates 100 times but just
    > shows once:

Fernando and I made a conscious choice to turn off interactive mode
when running scripts from ipython, since this is usually what people
want and has better performance. To override this, to need to
explicitly turn on/and off interactive mode where desired, and
possibly explicitly call draw in the animation loop where you want the
figure to be refreshed.

    import scipy
    import matplotlib
    from matplotlib import pylab

    pylab.ion() # turn on interactive mode
    for x in scipy.arange(100):
        pylab.plot(scipy.randn(1000)+x)

    pylab.show()

You can turn interactive mode on and off where desired with pylab.ion
and pylab.ioff (to suppress draws for a sequence of figure updates)
and explicitly draw where desired with pylab.draw. Details at
http://matplotlib.sf.net/interactive.html.

JDH

Fernando and I made a conscious choice to turn off interactive mode

Fair enough, but the change needs to be documented as such either in the
ipython manual or in the matplotlib changelog.

You can turn interactive mode on and off where desired with pylab.ion
and pylab.ioff (to suppress draws for a sequence of figure updates)
and explicitly draw where desired with pylab.draw.

Now that explicit control is necessary with draw(), could we go one step
further and ask for just one figure/subplot to be updated with the pythonic
API? Perhaps something along the lines of the following:

myFigure = pylab.figure()
myPlot1 = myfigure.add_subplot(2,1,1)
myPlot2 = myfigure.add_subplot(2,1,2)
doSetup()
for x in arange(y):
  z = doSomething()
  myPlot1.plot(...)
  myPlot1.drawNow() # New API
  if hokeyRareCondition:
    myPlot2.plot(...)
    myPlot2.drawNow() # New API

I see that there is a function in the figure API for drawing to a renderer but
I do not know how to use it to get the drawNow() effect.

Regards,
Ravi

···

On Tuesday 26 April 2005 05:26 pm, John Hunter wrote:

> You can turn interactive mode on and off where desired with pylab.ion
> and pylab.ioff (to suppress draws for a sequence of figure updates)
> and explicitly draw where desired with pylab.draw.

Now that explicit control is necessary with draw(), could we go one step
further and ask for just one figure/subplot to be updated with the pythonic
API? Perhaps something along the lines of the following:

myFigure = pylab.figure()
myPlot1 = myfigure.add_subplot(2,1,1)
myPlot2 = myfigure.add_subplot(2,1,2)
doSetup()
for x in arange(y):
  z = doSomething()
  myPlot1.plot(...)
  myPlot1.drawNow() # New API
  if hokeyRareCondition:
    myPlot2.plot(...)
    myPlot2.drawNow() # New API

I see that there is a function in the figure API for drawing to a renderer but
I do not know how to use it to get the drawNow() effect.

Could I +1 this as a request. I had a look into trying to do this myself
but got down to the level of renderers and decided to leave it alone,
since it's not really critical to me, just a nice feature if it existed.

Cheers,

Tim

Regards,
Ravi

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

`-

···

On Wed, 27 Apr 2005, ravi@...380... <ravi@...380...> wrote...

Quoting John Hunter <jdhunter@...8...>:

    > Hi, I just upgraded to 0.80 from 0.73.1 on a Fedora Core 3
    > machine. I am (and have been) using ipython 0.6.13 as my
    > shell. After the upgrade, plots from scripts are no longer
    > interactive - I need an explicit call to pylab.show() to
    > show the plots.

    > Do I need to update some settings? I am using the GTKAgg
    > backend with all default parameters (no user-specific
    > .matplotlibrc) and I compiled matplotlib from sources. Here
    > is a simple script that no longer updates 100 times but just
    > shows once:

Fernando and I made a conscious choice to turn off interactive mode
when running scripts from ipython, since this is usually what people
want and has better performance. To override this, to need to
explicitly turn on/and off interactive mode where desired, and
possibly explicitly call draw in the animation loop where you want the
figure to be refreshed.

    import scipy
    import matplotlib
    from matplotlib import pylab

    pylab.ion() # turn on interactive mode
    for x in scipy.arange(100):
        pylab.plot(scipy.randn(1000)+x)

    pylab.show()

A small note to clarify why we did this: we wanted to make sure that a script
which works correctly under ipython's %run will work equally well outside of
ipython. That's why I removed the automagic calling of show() by ipython, to
force users to write valid matplotlib scripts regardless of where they want to
run them. You only need to use ion/ioff if you want to have fine control over
how matplotlib updates its plots. I personally never use those, and I simply
make sure that all my mpl scripts have a show() call on their last line.

Regards,

f