栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Python

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python

你基本上有两个选择:

精确执行当前操作,但在重新配置数据之前先致电

graph1.clear()
graph2.clear()
。这是最慢但最简单,最可靠的选择。

除了重新绘制外,你还可以更新绘图对象的数据。你需要在代码中进行一些更改,但这比每次重新绘制都快得多。但是,你要绘制的数据的形状无法更改,并且如果数据范围正在更改,则需要手动重置x和y轴限制。

举一个第二种选择的例子:

import matplotlib.pyplot as pltimport numpy as npx = np.linspace(0, 6*np.pi, 100)y = np.sin(x)# You probably won't need this if you're embedding things in a tkinter plot...plt.ion()fig = plt.figure()ax = fig.add_subplot(111)line1, = ax.plot(x, y, 'r-') # Returns a tuple of line objects, thus the commafor phase in np.linspace(0, 10*np.pi, 500):    line1.set_ydata(np.sin(x + phase))    fig.canvas.draw()    fig.canvas.flush_events()


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/372482.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号