In [1]:
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd

In [2]:
%matplotlib notebook

In [97]:
# bodyNames = ['Sol', 'Mercury', 'Venus', 'Earth', 'Mars']
bodyNames = ['Sol', 'Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto',
             '2015 ME131', '(29075) 1950 DA', '101955 Bennu', 'Comet Halley', ]
bodies = { name: pd.read_csv(name+'.csv', names=['t', 'x', 'y', 'z', 'vx', 'vy', 'vz'])
           for name in bodyNames }

In [98]:
fig = plt.figure()
ax = fig.gca(projection='3d')
for name, body in bodies.items():
    ax.plot(body.x, body.y, body.z, label=name)
ax.set_zlim3d(ax.get_xlim3d())
ax.legend()


Out[98]:
<matplotlib.legend.Legend at 0x7f36dec96b00>