realtime plotting was working with matplotlib 0.99.1.1 and it doesn't with matplotlib 1.0.0

Hi all,
I have a script to update a plot in real time. It was working fine with matplotlib 0.99.1.1 but it doesn’t work anymore with the new version.

Here is the script:

import numpy as n
import pylab as p

x=n.arange(10)
y=n.random.randn(10)
p.ion()
fig=p.figure(1)
ax=fig.add_subplot(111)
line,=ax.plot(x,y,‘ko-’)
for i in range(10):
y=n.random.randn(10)
line.set_data(x,y)
p.draw()

it is updating the plot correctly with matplotlib 0.99.1.1
when I run it with matplotlib 1.0.0
it doesn’t show any picture at all

Interestingly, if I add a line raw_input(‘ok’) then it shows the plot and it updates it inside the loop…

x=n.arange(10)
y=n.random.randn(10)
p.ion()
fig=p.figure(1)
ax=fig.add_subplot(111)
line,=ax.plot(x,y,‘ko-’)
raw_input(‘ok?’)
for i in range(10):
y=n.random.randn(10)
line.set_data(x,y)
p.draw()
raw_input(‘ok?’)

Any idea why it is doing this? Is it a bug or am I missing something?

Thanks for your help,
Chiara

It seems to work fine for me using the GTKAgg backend. Which backend are you using? Also, admittedly, this is the trunk build, so it might have some fixes that weren’t in the release.

Ben Root

···

On Fri, Aug 27, 2010 at 9:26 PM, Chiara Caronna <chiaracaronna@…32…> wrote:

Hi all,
I have a script to update a plot in real time. It was working fine with matplotlib 0.99.1.1 but it doesn’t work anymore with the new version.

Here is the script:

import numpy as n
import pylab as p

x=n.arange(10)
y=n.random.randn(10)
p.ion()
fig=p.figure(1)
ax=fig.add_subplot(111)
line,=ax.plot(x,y,‘ko-’)
for i in range(10):
y=n.random.randn(10)
line.set_data(x,y)
p.draw()

it is updating the plot correctly with matplotlib 0.99.1.1
when I run it with matplotlib 1.0.0
it doesn’t show any picture at all

Interestingly, if I add a line raw_input(‘ok’) then it shows the plot and it updates it inside the loop…

x=n.arange(10)
y=n.random.randn(10)
p.ion()
fig=p.figure(1)
ax=fig.add_subplot(111)
line,=ax.plot(x,y,‘ko-’)
raw_input(‘ok?’)
for i in range(10):
y=n.random.randn(10)

line.set_data(x,y)
p.draw()
raw_input('ok?')

Any idea why it is doing this? Is it a bug or am I missing something?

Thanks for your help,
Chiara

I think I am using TkAgg but I am not sure, how can I check it?

···

From: ben.root@…1304…
Date: Fri, 27 Aug 2010 21:50:19 -0500
Subject: Re: [Matplotlib-users] realtime plotting was working with matplotlib 0.99.1.1 and it doesn’t with matplotlib 1.0.0
To: chiaracaronna@…32…
CC: matplotlib-users@lists.sourceforge.net

On Fri, Aug 27, 2010 at 9:26 PM, Chiara Caronna <chiaracaronna@…32…> wrote:

Hi all,
I have a script to update a plot in real time. It was working fine with matplotlib 0.99.1.1 but it doesn’t work anymore with the new version.

Here is the script:

import numpy as n
import pylab as p

x=n.arange(10)
y=n.random.randn(10)
p.ion()
fig=p.figure(1)
ax=fig.add_subplot(111)
line,=ax.plot(x,y,‘ko-’)
for i in range(10):
y=n.random.randn(10)
line.set_data(x,y)
p.draw()

it is updating the plot correctly with matplotlib 0.99.1.1
when I run it with matplotlib 1.0.0
it doesn’t show any picture at all

Interestingly, if I add a line raw_input(‘ok’) then it shows the plot and it updates it inside the loop…

x=n.arange(10)
y=n.random.randn(10)
p.ion()
fig=p.figure(1)
ax=fig.add_subplot(111)
line,=ax.plot(x,y,‘ko-’)
raw_input(‘ok?’)
for i in range(10):
y=n.random.randn(10)

line.set_data(x,y)
p.draw()
raw_input('ok?')

Any idea why it is doing this? Is it a bug or am I missing something?

Thanks for your help,
Chiara

It seems to work fine for me using the GTKAgg backend. Which backend are you using? Also, admittedly, this is the trunk build, so it might have some fixes that weren’t in the release.

Ben Root

Ok, it is a backend issue:
I checked and I was using Qt4Agg
as soon as I changed to TkAgg the script worked fine…
still is this normal or is it a bug?
thanks for your suggestion and help!
Chiara

···

From: chiaracaronna@…32…
To: ben.root@…1304…
Date: Sat, 28 Aug 2010 03:01:54 +0000
CC: matplotlib-users@…563…eforge.net
Subject: Re: [Matplotlib-users] realtime plotting was working with matplotlib 0.99.1.1 and it doesn’t with matplotlib 1.0.0

I think I am using TkAgg but I am not sure, how can I check it?


From: ben.root@…1304…
Date: Fri, 27 Aug 2010 21:50:19 -0500
Subject: Re: [Matplotlib-users] realtime plotting was working with matplotlib 0.99.1.1 and it doesn’t with matplotlib 1.0.0
To: chiaracaronna@…32…
CC: matplotlib-users@lists.sourceforge.net

On Fri, Aug 27, 2010 at 9:26 PM, Chiara Caronna <chiaracaronna@…32…> wrote:

Hi all,
I have a script to update a plot in real time. It was working fine with matplotlib 0.99.1.1 but it doesn’t work anymore with the new version.

Here is the script:

import numpy as n
import pylab as p

x=n.arange(10)
y=n.random.randn(10)
p.ion()
fig=p.figure(1)
ax=fig.add_subplot(111)
line,=ax.plot(x,y,‘ko-’)
for i in range(10):
y=n.random.randn(10)
line.set_data(x,y)
p.draw()

it is updating the plot correctly with matplotlib 0.99.1.1
when I run it with matplotlib 1.0.0
it doesn’t show any picture at all

Interestingly, if I add a line raw_input(‘ok’) then it shows the plot and it updates it inside the loop…

x=n.arange(10)
y=n.random.randn(10)
p.ion()
fig=p.figure(1)
ax=fig.add_subplot(111)
line,=ax.plot(x,y,‘ko-’)
raw_input(‘ok?’)
for i in range(10):
y=n.random.randn(10)

line.set_data(x,y)
p.draw()
raw_input('ok?')

Any idea why it is doing this? Is it a bug or am I missing something?

Thanks for your help,
Chiara

It seems to work fine for me using the GTKAgg backend. Which backend are you using? Also, admittedly, this is the trunk build, so it might have some fixes that weren’t in the release.

Ben Root


Sell apps to millions through the Intel(R) Atom™ Developer Program
Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future.


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net

I suspect that it might have been fixed since 1.0 was released, but I am unable to confirm that using the machine I have with me. Can someone using the svn build of mpl check to see if the script works with the Qt4Agg backend?

Ben Root

···

On Fri, Aug 27, 2010 at 10:17 PM, Chiara Caronna <chiaracaronna@…32…> wrote:

Ok, it is a backend issue:
I checked and I was using Qt4Agg
as soon as I changed to TkAgg the script worked fine…
still is this normal or is it a bug?
thanks for your suggestion and help!
Chiara

    Ok, it is a backend issue:
    I checked and I was using Qt4Agg
    as soon as I changed to TkAgg the script worked fine...
    still is this normal or is it a bug?
    thanks for your suggestion and help!
    Chiara

I suspect that it might have been fixed since 1.0 was released, but I am
unable to confirm that using the machine I have with me. Can someone
using the svn build of mpl check to see if the script works with the
Qt4Agg backend?

No, it does not work on qt4agg, but it does work on qtagg and wxagg as well as gtkagg and tkagg.

Eric

···

On 08/27/2010 05:43 PM, Benjamin Root wrote:

On Fri, Aug 27, 2010 at 10:17 PM, Chiara Caronna > <chiaracaronna@...32... <mailto:chiaracaronna@…32…>> wrote:

Ben Root

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Ok, it is a backend issue:
I checked and I was using Qt4Agg
as soon as I changed to TkAgg the script worked fine...
still is this normal or is it a bug?
thanks for your suggestion and help!

Chiara,

As a workaround for Qt4Agg, you can follow p.draw() with fig.canvas.flush_events().

I think this is a bug that will be fixed easily by incorporating the flush functionality in the draw method, but I'm not ready to commit to it yet.

I wonder whether you were using a different backend when you were using 0.99.1.1? Or a different version of PyQt4?

Eric

···

On 08/27/2010 05:17 PM, Chiara Caronna wrote:

Chiara

------------------------------------------------------------------------
From: chiaracaronna@...32...
To: ben.root@...1304...
Date: Sat, 28 Aug 2010 03:01:54 +0000
CC: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] realtime plotting was working with
matplotlib 0.99.1.1 and it doesn't with matplotlib 1.0.0

I think I am using TkAgg but I am not sure, how can I check it?

------------------------------------------------------------------------
From: ben.root@...1304...
Date: Fri, 27 Aug 2010 21:50:19 -0500
Subject: Re: [Matplotlib-users] realtime plotting was working with
matplotlib 0.99.1.1 and it doesn't with matplotlib 1.0.0
To: chiaracaronna@...32...
CC: matplotlib-users@lists.sourceforge.net

On Fri, Aug 27, 2010 at 9:26 PM, Chiara Caronna > <chiaracaronna@...32... <mailto:chiaracaronna@…32…>> wrote:

    Hi all,
    I have a script to update a plot in real time. It was working fine
    with matplotlib 0.99.1.1 but it doesn't work anymore with the new
    version.

    Here is the script:

    import numpy as n
    import pylab as p

    x=n.arange(10)
    y=n.random.randn(10)
    p.ion()
    fig=p.figure(1)
    ax=fig.add_subplot(111)
    line,=ax.plot(x,y,'ko-')
    for i in range(10):
    y=n.random.randn(10)
    line.set_data(x,y)
    p.draw()

    it is updating the plot correctly with matplotlib 0.99.1.1
    when I run it with matplotlib 1.0.0
    it doesn't show any picture at all

    Interestingly, if I add a line raw_input('ok') then it shows the
    plot and it updates it inside the loop....

    x=n.arange(10)
    y=n.random.randn(10)
    p.ion()
    fig=p.figure(1)
    ax=fig.add_subplot(111)
    line,=ax.plot(x,y,'ko-')
    raw_input('ok?')
    for i in range(10):
    y=n.random.randn(10)
    line.set_data(x,y)
    p.draw()
    raw_input('ok?')

    Any idea why it is doing this? Is it a bug or am I missing something?

    Thanks for your help,
    Chiara

It seems to work fine for me using the GTKAgg backend. Which backend are
you using? Also, admittedly, this is the trunk build, so it might have
some fixes that weren't in the release.

Ben Root

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be
part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue
and speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________ Matplotlib-users mailing
list Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options