anim.py
来自「非原创。很好的python例子」· Python 代码 · 共 33 行
PY
33 行
#!/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 + =
减小字号Ctrl + -
显示快捷键?