从excel 导入数据绘制 散点图
import xlrd
import matplotlib.pyplot as plt
bok = xlrd.open_workbook(r\’test.xls\’)
sht = bok.sheets()[0]
row1 = sht.row_values(0)
X=sht.col_values(0 , start_rowx=0, end_rowx=None)
Y=sht.col_values(1 , start_rowx=0, end_rowx=None)
plt.plot(X,Y,”ro”)
EXCEL数据示例:
绘制图形示例: