[IPython-User] matplotlib / pylab update delay.

Adrian Ratnapala adrian.ratnapala@gmail....
Mon Aug 16 07:22:15 CDT 2010


Hi,

A while ago I reported that in iPython 0.10, figures did not update as
quickly as they should when running "ipython -pylab".  I've finally
gotten around to testing this out with the nightly-build of 0.11.

An example of this problem is: docs/examples/lib/gui-mpl.py, the
number displayed on the figure title usually lags the number written
to stdout by one.  Sometimes you get nondeterministic behaviour where
two "frames" are displayed in very quick succession.

To see this you need to add a delay, so I have attached a version of
the file hacked appropriately.  Gui used the last time I ran it was
qt4, but I have also observed this with gtk.


Cheers.

-- Here is my original report
------------------------------------------------------------------------

On 19 May 2010 19:22, Brian Granger <ellisonbg@gmail.com> wrote:
> Which version of IPython are you running?
>
> Brian
>
> On Wed, May 19, 2010 at 5:13 AM, Adrian Ratnapala
> <adrian.ratnapala@gmail.com> wrote:
>> If I run ipython -pylab, and then run a script with graphics,
>> when are the plots supposed to be updated.  Suppose I
>> have a long computation and want to  give the viewers
>> some information while it happens.  Then I might do:
>>
>> from pylab import *
>> from numpy import *
>> import sys, time
>>
>> clf()
>> x = linspace(-1, 1, 101)
>> for k in range(4) :
>>        plot( x, (1+k) * x**2 )
>>        draw()
>>        print 'quad term = ' ,  1+k
>>        sys.stdout.flush()
>>        time.sleep(3)  # or some other long computation.
>> show()
>>
>>
>>
>> However, I find that the visible plot is always one iteration
>> behind what is reported on stdout.
>>
>> Another, probably related problem, is that the GUI is
>> unresponsive when such scripts run.  Presumably
>> this second problem is hard to fix, because the
>> computation and  the GUI are running in the same
>> thread.   However, I just don't understand the delayed
>> output.
>>
>>
>> --
>> Adrian Ratnapala
>>
>> Centre for Cold Matter,
>> The Blackett Laboratory,
>> Imperial College London,
>> Prince Consort Road,
>> London SW7 2AZ.
>>
>> Tel: +44-(0)2075947864
>> Fax: +44-(0)2075947714
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>
>
>
> --
> Brian E. Granger, Ph.D.
> Assistant Professor of Physics
> Cal Poly State University, San Luis Obispo
> bgranger@calpoly.edu
> ellisonbg@gmail.com
>



-- 
Adrian Ratnapala

Centre for Cold Matter,
The Blackett Laboratory,
Imperial College London,
Prince Consort Road,
London SW7 2AZ.

Tel: +44-(0)2075947864
Fax: +44-(0)2075947714
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gui-mpl-hack.py
Type: text/x-python
Size: 1385 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/ipython-user/attachments/20100816/026619ae/attachment.py 


More information about the IPython-User mailing list