单个图上的多个线图,带有呈现延迟
道歉,如果我错过了正确的事先答案,我已经搜索了数十个类似的查询,以了解我认为这是一个简单的答案。我不是合格的程序员,而是在各种数据收集和演示解决方案中攻击了自己的方式。我正在尝试绘制从仪器输出.CSV导入的大量数据集。可视化数据的变化是绘图的原因,对我来说,以用户控制的速率(例如,使用plt.pause())显示数据很重要。这是我现在拥有的简化版本:
data = [{'channel_no':0,'value1':0,'value2':0,'value3':0,'value4':0,'value5':0 },, {'channel_no':1,'value1':2,'value2':1,'value3':3,'value4':4,'value5':5}, {'channel_no':2,'value1':4,'value2':2,'value3':6,'value4':8,'value5':10}, {'channel_no':3,'value1':6,'value2':3,'value3':9,'value4':12,'value5':15}, {'channel_no':4,'value1':8,'value2':4,'value3':12,'value4':16,'value5':20}, {'channel_no':5,'value1':10,'value2':5,'value3':15,'value4':20,'value5':25}, {'channel_no':6,'value1':8,'value2':4,'value3':12,'value4':16,'value5':20}, {'channel_no':7,'value1':6,'value2':3,'value3':9,'value4':12,'value5':15}, {'channel_no':8,'value1':4,'value2':2,'value3':6,'value4':8,'value5':10}, {'channel_no':9,'value1':2,'value2':1,'value3':3,'value4':4,'value5':5}, {'channel_no':10,'value1':0,'value2':0,'value3':0,'value4':0,'value5':0}]
df = pd.dataframe(data)
df.plot( x = 0)
成功输出:
但这都是共同创建的。如何绘制第1列('值1'),等待10秒和绘图列2('value 2'),依此类推,而不重新创建图形?我可以以艰难的方式(修剪数据并在循环中绘制)做到这一点,但这在眼睛上非常困难,因为每行添加都会引起绘图刷新。提前致谢。
With apologies if I have missed a correct prior answer, I have searched dozens of similar inquiries for what I think is a simple answer. I am not a qualified programmer but have hacked my way through a wide variety of data collection and presentation solutions. I am trying to plot a large collection of data imported from an instrument output .csv. Visualizing the change in data is the reason for the plot, it is important to me to present the data at a user-controlled rate (e.g., with plt.pause()). Here is a simplified version of what I have now:
data = [{'Channel_No':0, 'Value1': 0, 'Value2': 0, 'Value3': 0, 'Value4': 0, 'Value5': 0},
{'Channel_No':1, 'Value1': 2, 'Value2': 1, 'Value3': 3, 'Value4': 4, 'Value5': 5},
{'Channel_No':2, 'Value1': 4, 'Value2': 2, 'Value3': 6, 'Value4': 8, 'Value5': 10},
{'Channel_No':3, 'Value1': 6, 'Value2': 3, 'Value3': 9, 'Value4': 12, 'Value5': 15},
{'Channel_No':4, 'Value1': 8, 'Value2': 4, 'Value3': 12, 'Value4': 16, 'Value5': 20},
{'Channel_No':5, 'Value1': 10, 'Value2': 5, 'Value3': 15, 'Value4': 20, 'Value5': 25},
{'Channel_No':6, 'Value1': 8, 'Value2': 4, 'Value3': 12, 'Value4': 16, 'Value5': 20},
{'Channel_No':7, 'Value1': 6, 'Value2': 3, 'Value3': 9, 'Value4': 12, 'Value5': 15},
{'Channel_No':8, 'Value1': 4, 'Value2': 2, 'Value3': 6, 'Value4': 8, 'Value5': 10},
{'Channel_No':9, 'Value1': 2, 'Value2': 1, 'Value3': 3, 'Value4': 4, 'Value5': 5},
{'Channel_No':10, 'Value1': 0, 'Value2': 0, 'Value3': 0, 'Value4': 0, 'Value5': 0}]
df=pd.DataFrame(data)
df.plot(x=0)
with successful output:
But this is all created together. How do I plot column 1 ('Value 1'), wait 10 seconds, and plot column 2 ('Value 2'), and so on, without re-creating the figure? I can do this the hard way (trimming the data and plotting in a loop) but that is pretty hard on the eyes because every line addition invokes a plot refresh. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为在您的情况下这应该有效:
I think this should work in your case: