【发布时间】:2018-07-11 01:31:27
【问题描述】:
我正在使用 python 3.6,在运行以下代码时,我收到错误消息
回溯(最近一次通话最后):
文件“C:/Users/Sagar/AppData/Local/Programs/Python/Python36-32/graphfile.py”,第 10 行,在
plt.plot(x,y)
AttributeError:模块'matplotlib'没有属性'plot'
代码是
import matplotlib as plt
x=[]
y=[]
readfile=open("graph.txt","r")
data=readfile.read().split("\n")
for i in data:
val=i.split(",")
x.append(int(val[0]))
y.append(int(val[1]))
plt.plot(x,y)
plt.show()
【问题讨论】:
-
import matplotlib.pyplot as plt
标签: python matplotlib plot attributeerror