Skip to content

Commit 5cadac1

Browse files
committed
Merge pull request #4724 from tacaswell/doc_update_demo
DOC: slightly update demo
2 parents 0bbc091 + 188d7a1 commit 5cadac1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/pylab_examples/system_monitor.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ def get_stats():
4040
ax.set_ylabel('Percent usage')
4141
ax.set_title('System Monitor')
4242

43+
start = time.time()
4344
for i in range(200): # run for a little while
4445
m, c, n = get_stats()
4546

4647
pm.set_height(m)
4748
pc.set_height(c)
4849
pn.set_height(n)
49-
ax.set_ylim([0, 100])
50+
try:
51+
fig.canvas.flush_events()
52+
except NotImplementedError:
53+
pass
5054

51-
plt.draw()
55+
stop = time.time()
56+
print("{fps:.1f} frames per second".format(fps=200 / (stop - start)))

0 commit comments

Comments
 (0)