您是否考虑过使用matplotlib滑块小部件?
这里有一些代码只是作为示例显示
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.widgets import Sliderfig, ax = plt.subplots()plt.subplots_adjust(bottom=0.25)t = np.arange(0.0, 100.0, 0.1)s = np.sin(2*np.pi*t)l, = plt.plot(t,s)plt.axis([0, 10, -1, 1])axcolor = 'lightgoldenrodyellow'axpos = plt.axes([0.2, 0.1, 0.65, 0.03], axisbg=axcolor)spos = Slider(axpos, 'Pos', 0.1, 90.0)def update(val): pos = spos.val ax.axis([pos,pos+10,-1,1]) fig.canvas.draw_idle()spos.on_changed(update)plt.show()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)