第一次用python进行数据分析,速度很快很强大
# -*- coding: utf-8 -*-
"""Created on Thu Sep 22 11:39:29 2016
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
yindex=np.arange(10,1510,10)
xindex=np.arange(0,1824.4,0.4)
df = pd.read_excel("meshdata.xls",header=None,names=yindex)
df.index=xindex
fig=plt.figure(figsize=(20,10))
ax=fig.add_subplot(111)
#plt.plot(df.index,df.loc[:,[10,20,30,40,50,60]])
#plt.legend(['10mm','20mm','30mm','40mm','50mm','60mm'])
plt.plot(yindex,df.loc[[0.4,900,1200,1800],:].T)
plt.grid()
plt.xlabel("Y Position(mm)")
plt.ylabel("Floating Height(mm)")
plt.title("Floating Height along Y-axis")
plt.legend(['0.4mm','900mm','1200mm','1800mm'])
plt.xlim(-20,1600)
plt.xticks(np.arange(-100,1700,100))
x_center=[]
for i in range(12):
x0=62.5
stroke=160
x_center.append(125*i+x0)
y0=0.035 if i%2==0 else 0.04
x=[x_center[i]-stroke/2,x_center[i]+stroke/2]
y=[y0,y0]
optics=plt.plot(x,y)
plt.setp(optics,linewidth=5.0)
plt.plot([750,750],[0,0.09],'g--')
plt.show()