|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import matplotlib.pyplot as plt
import numpy as np
infile = open('statesSummary.csv','r')
yearLine = infile.readline()
yearWords = yearLine.split(",")
years = []
for w in yearWords[1:]:
years.append(int(w))
for i in range(5):
line = infile.readline()
words = line.split(",")
stateName = words[0]
stateValues = []
for w in words[1:]:
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
|
|