Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b72fd23 commit 5d43b3bCopy full SHA for 5d43b3b
2 files changed
examples/animation/dynamic_demo.py
examples/animation/gtk_timeout.py
@@ -0,0 +1,19 @@
1
+import gobject
2
+import numpy as np
3
+import matplotlib
4
+matplotlib.use('GTKAgg')
5
+
6
+import matplotlib.pyplot as plt
7
8
+fig = plt.figure()
9
+ax = fig.add_subplot(111)
10
+line, = ax.plot(np.random.rand(10))
11
+ax.set_ylim(0, 1)
12
13
+def update():
14
+ line.set_ydata(np.random.rand(10))
15
+ fig.canvas.draw_idle()
16
+ return True # return False to terminate the updates
17
18
+gobject.timeout_add(100, update) # you can also use idle_add to update when gtk is idle
19
+plt.show()
0 commit comments