From: Luka Napotnik <luka.napotnik@gm...>  20111125 13:14:05

Hello. I'm searching for a method to show a stream of data on a graph. So far I've only managed to get the stream on a regular graph but the data bandwidth is very high (100 samples/sec) and the usual graph doesn't handle redrawing so good. I was searching for a way to utilize the animation functionality of matplotlib but found only some Tk examples (with very smooth refresh rate). But I couldn't modify the source to create the same effect using the Gtk + frontend. The problem is that I don't know how to integrate the graph into the Glib main loop. Please help. This is an example I found o the net:  import matplotlib matplotlib.use('TkAgg') # do this before importing pylab import matplotlib.pyplot as plt import random fig = plt.figure() ax = fig.add_subplot(111) x = range(30) y = [random.random() for i in x] line, = ax.plot(x,y) def animate(*args): n = len(y) while True: data = random.random() y.append(data) n += 1 line.set_data(range(n30, n), y[30:]) ax.set_xlim(n31, n1) fig.canvas.draw() fig.canvas.manager.window.after(100, animate) plt.show()  