Question

I am trying to plot a simple stream of data coming sequentially (ie, a time dependent variable) but I could not get any output. I therefore tried different "solutions" proposed for real time plot in stackoverflow... but all I get is again no plot at all. I looked at the cookbook on animations (http://wiki.scipy.org/Cookbook/Matplotlib/Animations) and tried one of the given examples as well, reproduced here below:

from pylab import *
import time

ion()

tstart = time.time()               # for profiling
x = arange(0,2*pi,0.01)            # x-array
line, = plot(x,sin(x))
for i in arange(1,200):
    line.set_ydata(sin(x+i/10.0))  # update the data
    draw()                         # redraw the canvas

print 'FPS:' , 200/(time.time()-tstart)

Again, I got no graph output... just the final print. Can someone tell me why all the examples supposedly working, are actually not working?

Était-ce utile?

La solution

This works for me in iPython notebook (python 2.7).

Maybe you want to make sure your back-end setting for pylab is not set to inline?

[you'll likely have to restart your kernel for the changes to take effect]

Another possibility is that your process is still running from a previous attempt.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top