有没有大佬帮忙解惑
import matplotlib.pyplot as pltimport numpy as np
infile = open('statesSummary.csv','r')
yearLine = infile.readline()
yearWords = yearLine.split(",")
years = []
for w in yearWords:
years.append(int(w))
for i in range(5):
line = infile.readline()
words = line.split(",")
stateName = words
stateValues = []
for w in words:
stateValues.append(int(w))
color = np.random.rand(3)
plt.scatter(years, stateValues,c=color, label=stateName)
plt.title("Cases of Lyme Disease")
plt.xlabel('Years')
plt.ylabel('Number of Cases')
plt.legend(loc = 2,
fontsize = 'x-small')
plt.show()
图
本帖最后由 Daniel_Zhang 于 2021-2-11 15:32 编辑
这不是很简单的问题吗?list 没有 sppend
图里面第七行,拼写错误
是 append 不是 sppend
页:
[1]