【发布时间】:2019-04-07 04:30:40
【问题描述】:
为什么这段代码会产生如此奇怪的输出?
我希望绘图重叠,以便我可以看到重叠的数据点。
似乎这些图是相互堆叠的。
def read_csv(name):
file = open(folder+name,newline='')
reader = csv.reader(file,delimiter=";")
data = []
for row in reader:
data.append(np.array(row[5:]))
file.close()
return data
def setup_plotting():
fig = plt.figure()
ax = fig.add_subplot(111)
ax.xaxis.set_major_locator(plt.MaxNLocator(10))
ax.yaxis.set_major_locator(plt.MaxNLocator(10))
return ax
acc_x = read_csv("acc_x.csv")
ax=setup_plotting()
for entry in acc_x:
ax.plot(entry)
请帮帮我:)
【问题讨论】:
-
如果注释掉
set_major_locator行会发生什么? -
相同的图,但有很多不同的值,你无法在 y 轴上读取任何内容
-
你能编辑你的帖子并举个例子
acc_x让我测试一下吗?
标签: python matplotlib plot data-science