【GAMP】繪製Gamp中位置.pos檔案
阿新 • • 發佈:2018-12-10
# -*- coding: utf-8 -*- """ Created on Tue Aug 28 14:18:10 2018 @author ouyangmingjun [email protected] """ import matplotlib.pyplot as plt import numpy as np import os def plot(path,i): a = np.loadtxt(path)#最普通的loadtxt #print(a[:,-3:]) lim1=[10]*24 lim2=[-10]*24 # x=np.linspace(0,24,len(a[:,-3])) plt.figure(i) plt.plot(a[:,-3]*100,"b-",label="N",linewidth=3.8) plt.plot(a[:,-2]*100,"g-",label="E",linewidth=3.8) #plt.plot(x,a[:1440,-3]*100,"b-",label="N",linewidth=5.8) plt.plot(a[:,-1]*100,"r-",label="U",linewidth=3.8) plt.plot(lim1,"m--") plt.plot(lim2,"m--") font2 = {'family' : 'Times New Roman', 'weight' : 'normal', 'size' : 15, } plt.ylabel("/cm",font2) plt.xlabel("/hour",font2) plt.title("DOY(230) 2018 BRUX predict 60min",font2) plt.ylim(-50,50) plt.legend() plt.grid("on") plt.savefig(path+"{0}.png".format(i),dpi=300) if __name__ == '__main__': i=0 pathlist=os.listdir() for file in pathlist: if file.endswith(".pos"): plot(file,i) i=i+1