如何在“ while”中绘制一条线python中的循环?
尝试使用matplotlib在“ while”循环中绘制线路。 这显示了一个空白的图:
plt.plot(t, cash)
plt.xlim([t_start, t_end])
plt.ylim([c_min,c_max])
plt.pause(0.1)
然后使用:
plt.plot(t, cash,'r.')
plt.xlim([t_start, t_end])
plt.ylim([c_min,c_max])
plt.pause(0.1)
如预期的那样,显示了随行循环更新的红点。 如何用一条线得到这个情节? 谢谢 !
Trying to plot a line inside a "while" loop using matplotlib.
This shows a blank figure:
plt.plot(t, cash)
plt.xlim([t_start, t_end])
plt.ylim([c_min,c_max])
plt.pause(0.1)
then using:
plt.plot(t, cash,'r.')
plt.xlim([t_start, t_end])
plt.ylim([c_min,c_max])
plt.pause(0.1)
shows red dots being updated with the while loop, as expected.
How to get this plot with a line?
Thank You !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否理解这个问题,但听起来您只是想用线路绘制点?
I am not sure if I understand the problem, but it sounds like you simply want to exchange the dot with a line plot?