real time plotting

I want to update a plot in real time. I did some goog search, and saw various
answers. Trouble is, they aren't working.

Here's a typical example:

import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure()
plt.axis([0,1000,0,1])

i=0
x=list()
y=list()

while i <1000:
    temp_y=np.random.random()
    x.append(i)
    y.append(temp_y)
    plt.scatter(i,temp_y)
    i+=1
    plt.draw()

If I run this, it draws nothing.

This is my matplotlibrc:
backend : Qt4Agg
mathtext.fontset: stix

Dear Neal,

···

2013/3/11 Neal Becker <ndbecker2@…287…>

I want to update a plot in real time. I did some goog search, and saw various

answers. Trouble is, they aren’t working.

Here’s a typical example:

import matplotlib.pyplot as plt

import numpy as np

fig=plt.figure()

plt.axis([0,1000,0,1])

i=0

x=list()

y=list()

while i <1000:

temp_y=np.random.random()

x.append(i)

y.append(temp_y)

plt.scatter(i,temp_y)

i+=1

plt.draw()

If I run this, it draws nothing.

This is my matplotlibrc:

backend : Qt4Agg

mathtext.fontset: stix

do you use interactive mode? (plt.ion() before creating the figure)

Francesco


Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester

Wave™: Endpoint Security, Q1 2013 and “remains a good choice” in the

endpoint security space. For insight on selecting the right partner to

tackle endpoint security challenges, access the full report.

http://p.sf.net/sfu/symantec-dev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Tried with/and without plt.ion(), no difference. Nothing is drawn. When I kill it with C-c, briefly a window is flashed.

import matplotlib as mpl

import matplotlib.pyplot as plt

plt.ion()

import numpy as np

fig=plt.figure()

plt.axis([0,1000,0,1])

i=0

x=list()

y=list()

while i <1000:

temp_y=np.random.random()

x.append(i)

y.append(temp_y)

plt.scatter(i,temp_y)

i+=1

plt.draw()

···

On Mon, Mar 11, 2013 at 9:55 AM, Francesco Montesano <franz.bergesund@…287…> wrote:

Dear Neal,

2013/3/11 Neal Becker <ndbecker2@…287…>

I want to update a plot in real time. I did some goog search, and saw various

answers. Trouble is, they aren’t working.

Here’s a typical example:

import matplotlib.pyplot as plt

import numpy as np

fig=plt.figure()

plt.axis([0,1000,0,1])

i=0

x=list()

y=list()

while i <1000:

temp_y=np.random.random()

x.append(i)

y.append(temp_y)

plt.scatter(i,temp_y)

i+=1

plt.draw()

If I run this, it draws nothing.

This is my matplotlibrc:

backend : Qt4Agg

mathtext.fontset: stix

do you use interactive mode? (plt.ion() before creating the figure)

Francesco


Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester

Wave™: Endpoint Security, Q1 2013 and “remains a good choice” in the

endpoint security space. For insight on selecting the right partner to

tackle endpoint security challenges, access the full report.

http://p.sf.net/sfu/symantec-dev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

mpl is 1.2.0
Fedora linux

···

On Mon, Mar 11, 2013 at 9:57 AM, Neal Becker <ndbecker2@…287…> wrote:

Tried with/and without plt.ion(), no difference. Nothing is drawn. When I kill it with C-c, briefly a window is flashed.

import matplotlib as mpl

import matplotlib.pyplot as plt

plt.ion()

import numpy as np

fig=plt.figure()

plt.axis([0,1000,0,1])

i=0

x=list()

y=list()

while i <1000:

temp_y=np.random.random()

x.append(i)

y.append(temp_y)

plt.scatter(i,temp_y)

i+=1

plt.draw()

On Mon, Mar 11, 2013 at 9:55 AM, Francesco Montesano <franz.bergesund@…287…> wrote:

Dear Neal,

2013/3/11 Neal Becker <ndbecker2@…287…>

I want to update a plot in real time. I did some goog search, and saw various

answers. Trouble is, they aren’t working.

Here’s a typical example:

import matplotlib.pyplot as plt

import numpy as np

fig=plt.figure()

plt.axis([0,1000,0,1])

i=0

x=list()

y=list()

while i <1000:

temp_y=np.random.random()

x.append(i)

y.append(temp_y)

plt.scatter(i,temp_y)

i+=1

plt.draw()

If I run this, it draws nothing.

This is my matplotlibrc:

backend : Qt4Agg

mathtext.fontset: stix

do you use interactive mode? (plt.ion() before creating the figure)

Francesco


Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester

Wave™: Endpoint Security, Q1 2013 and “remains a good choice” in the

endpoint security space. For insight on selecting the right partner to

tackle endpoint security challenges, access the full report.

http://p.sf.net/sfu/symantec-dev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users