from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
n = 100
x=[]
y=[]
z=[]
# For each set of style and range settings, plot n random points in the box
# defined by x in [23, 32], y in [0, 100], z in [zlow, zhigh].
with open('KeyFrameTrajectory.txt') as file:
for line in file:
tmp=line.split()
x.append(tmp[1])
y.append(tmp[2])
z.append(tmp[3])
x = [ float( x ) for x in x if x ]
y = [ float( y ) for y in y if y ]
z = [ float( z ) for z in z if z ]
fig=plt.figure()
ax=Axes3D(fig)
ax.scatter3D(x, y, z)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
plt.show()