8000 DOC: slightly update demo · matplotlib/matplotlib@8f2b84c · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f2b84c

Browse files
committed
DOC: slightly update demo
Gets a frame rate of ~75fps on my machine
1 parent 6ee9a4d commit 8f2b84c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/pylab_examples/system_monitor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ 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])
5050

51-
plt.draw()
51+
fig.canvas.flush_events()
52+
53+
stop = time.time()
54+
print("{fps:.1f} frames per second".format(fps=200 / (stop - start)))

0 commit comments

Comments
 (0)
0