在Python中使用两个for循环在一个图形中绘制多条线



在下面的代码中,我试图在一个图中绘制一些线。第二个循环给出一条线,第一个循环用不同的值重复这条线,所以我们在一个图中有很多条线。

问题是,一旦画好线,终点和起点就用直线相互连接。我不明白问题出在哪里。

while True:
inp  = float(input("PLEASE ENTER VALUE): "))
if inp==0:
print('***')
print('0 Is not acceptable')
print('***')
else:
nu_list=[]
Un_list=[]
for tmp in range (2,6):
for xx in range(1,819):
.... some lines of code
if inp<0:
if lim > 1:
pass
else:
nu_list.append(dfimppara.iloc[xx, 1] * 115)
ET_list.append(Un(xx, tmp))
plt.plot(nu_list, Un_list)
else: 
...#some lines of code

plt.show((

尝试在tmpfor循环中移动两个空列表。

while True:
inp  = float(input("PLEASE ENTER VALUE): "))
if inp==0:
print('***')
print('0 Is not acceptable')
print('***')
else:
for tmp in range (2,6):
nu_list=[]
Un_list=[]
for xx in range(1,819):
.... some lines of code

最新更新