python读取数据

import matplotlib.pyplot as plt
import numpy as np
import csv
plt.rcParams['font.sans-serif']=['SimHei']#显示中文
plt.rcParams['axes.unicode_minus']=False#显示正负号
x=[]
y=[]
with open('data.csv') as csvfile:
  plots=csv.reader(csvfile,delimiter=',')
  for row in plots:
    x.append(row[0])
    y.append(row[1])
plt.scatter(x,y)
plt.show()

posted @ 2019-08-23 13:01  朵朵奇fa  阅读(350)  评论(0编辑  收藏  举报