import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D a=np.loadtxt("kepler.dat") r_maa=6371. p = plt.figure().add_subplot(111,projection='3d') p.set_aspect("equal") p.set_xlabel("x") p.set_ylabel("y") p.set_xlim(-5,1) p.set_ylim(-3,3) p.set_zlim(-3,3) p.legend(loc='upper right') z=np.zeros_like(a[:,0]) t=np.arange(0,len(a[:,0]),10000) p.plot(a[:,1]/r_maa,a[:,2]/r_maa,z,color="red",label="traj") p.quiver(a[t,1]/r_maa,a[t,2]/r_maa,z[t],a[t,3],a[t,4],z[t],arrow_length_ratio=0.01,normalize='False',color='blue') p.quiver(a[t,1]/r_maa,a[t,2]/r_maa,z[t],a[t,5],a[t,6],z[t],arrow_length_ratio=0.01,normalize='False',color='green') p.legend() p.grid(color="black") plt.show()