superadvancer
2015-09-01 00:45在Python 的while循环里做不出图,是何原因
因为我前端读取数据花费的时间比较长,我需要在数据读取完毕之后作图,所以选择了while 循环来完成这件事情。但是在while循环中,并不能做出图来,现在我把问题找到,并简化成下面的样子,哪位能帮我分析分析具体,该如何修改。
import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,2*pi,20)
y=np.sin(x)
z=np.cos(x)
while 1:
nPlt = input('input nPlt:')
if nPlt == 1:
plt.plot(x,y)
elif nPlt == 2:
plt.plot(x,z)
else:
break
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- python更新pip失败,困扰了我好久
- python
- 8个回答
- 小白问题--在python中for循环结束位置在哪里呢?
- python
- 5个回答
- python如何用循环生成并输出有规律的数组内容?
- python
- list
- 1个回答
- 简单的while 循环结果展示问题
- python
- 2个回答
- python3 关于while语句的问题
- python
- 1个回答
换一换