📄 anim.py
字号:
#!/usr/bin/env python"""A simple example of an animated plot in matplotlib. You can test thespeed of animation of various backends by running the script with the'-dSomeBackend' flagSC Aug 31 2005 mpl 0.83.2:Here are some numbers from my system, where FPS is the frames renderedper second GTK 29 FPS GTKAgg 18 FPS GTKCairo 15 FPS TkAgg 13 FPS QkAgg 13 FPS"""import timeimport pylab as p# turn interactive mode on for dynamic updates. If you aren't in# interactive mode, you'll need to use a GUI event handler/timer.p.ion()tstart = time.time() # for profilingx = p.arange(0, 2*p.pi, 0.01) # x-arrayline, = p.plot(x, p.sin(x))for i in p.arange(1,200): line.set_ydata(p.sin(x+i/10.0)) # update the data p.draw() # redraw the canvasprint 'FPS:' , 200/(time.time()-tstart)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -