#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as anim a=np.loadtxt("kepler.dat") fig=plt.figure(figsize=(10,10)) p1 = plt.subplot(221) xmin=min(a[:,1])*1.1 xmax=max(a[:,1])*1.1 ymax=400000 ymin=-ymax plt.xlim(xmin, xmax) plt.ylim(ymin, ymax) p1.grid() p1.set_aspect("equal") maa=plt.Circle((0,0),6378,color="green") ohu=plt.Circle((0,0),6478,color="blue",fill=False) p1.add_artist(maa) p1.add_artist(ohu) def animf(i): sx = (a[i,1]) sy = (a[i,2]) kx = (a[i,5]) ky = (a[i,6]) sat.set_data(sx, sy) kuu.set_data(kx, ky) return sat,kuu sat, = p1.plot([], [], '.',color="red") kuu, = p1.plot([], [], 'o',color="blue") ani = anim.FuncAnimation(fig, animf, np.arange(1, len(a[:,0])),interval=1,repeat=False,blit=True) p2=plt.subplot(222) plt.xlim(xmin, xmax) plt.ylim(ymin, ymax) p2.plot(a[:,1],a[:,2],color="red",label="sat") p2.plot(a[:,5],a[:,6],color="blue",label="kuu") p2.set_aspect("equal") p2.grid(color="black") p2.legend(loc='upper right') p3=plt.subplot(223) p3.plot(a[:,0],a[:,8],color="red",label="dist") p3.grid(color="black") p3.set_xlabel("t") p3.set_ylabel("r") p3.legend(loc='upper right') p4=plt.subplot(224) p4.plot(a[:,0],a[:,9],color="black",label="vel") p4.grid(color="black") p4.set_xlabel("t") p4.set_ylabel("v") p4.legend(loc='upper right') plt.show()