python怎么用csv文件绘制图_Python:读取CSV文件并绘制散点图

我编写了一个脚本来计算尺寸为大的csv文件:27000行x 22列.

如何在CSV文件中读取以便在matplotlib中使用它,就像这个线程中的散点图一样?

axis range in scatter graphs

生成散点图的概念是可以理解的.已经尝试通过例如解析csv文件:

data=csv.reader(open('some_file.csv, 'rb'), delimiter='|', quotechar='"')

但没有成功.

这是一个快速的解决方案

def getColumn(filename, column):

results = csv.reader(open(filename), delimiter="\t")

return [result[column] for result in results]

然后你可以像这样使用它

time = getColumn("filename",0)

volt = getColumn("filaname",1)

plt.figure("Time/Volt")

plt.xlabel("Time(ms)")

plt.ylabel("Volt(mV)")

plt.plot(time,volt)

你可能感兴趣的:(python怎么用csv文件绘制图_Python:读取CSV文件并绘制散点图)