import xlrd
import matplotlib.pyplot as plt
import numpy as np
opencv = xlrd.open_workbook('.\opencv.xls')
opencv = opencv.sheets()[0]#第几个sheet
ransac = xlrd.open_workbook('.\RANSAC.xls')
ransac = ransac.sheets()[0]
matlab_ = xlrd.open_workbook('.\Matlab_d.xls')
matlab_ = matlab_.sheets()[0]
matlab = xlrd.open_workbook('.\matlab.xls')
matlab = matlab.sheets()[0]
# 获取整行和整列的值(数组) table=*.sheets()[i]
# print(table.row_values(0))
# print(table.col_values(1))
# 获取行数和列数
# nrows = table.nrows
# ncols = table.ncols
plt.plot([1,2,3,4,5,6,7,8],np.array(opencv.col_values(2)),'g',label='opencv')
plt.plot([1,2,3,4,5,6,7,8],np.array(ransac.col_values(2)),'b',label='ransac')
plt.plot([1,2,3,4,5,6,7,8],np.array(matlab_.col_values(2)),'y',label='matlab-')
plt.plot([1,2,3,4,5,6,7,8],np.array(matlab.col_values(2)),'r',label='matlab')
plt.xlabel("number", fontsize=12)
plt.ylabel("pixel", fontsize=12)
plt.legend(loc='best')#说明
plt.show()
python读取excel并绘制折线图
最新推荐文章于 2024-05-28 15:09:27 发布