Plotting in 3D

[1]:
import numpy as np

from poliastro.examples import *
from poliastro.plotting import *
[2]:
churi.plot(use_3d=True)
[3]:
frame = OrbitPlotter3D()

frame.plot(churi)
frame.plot(Orbit.from_body_ephem(Earth))
/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/twobody/orbit.py:608: UserWarning:

Frame <class 'astropy.coordinates.builtin_frames.icrs.ICRS'> does not support 'obstime', time values were not returned

[4]:
frame = OrbitPlotter3D()

frame.plot(molniya)
frame.plot(Orbit.from_body_ephem(Earth))
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-4-c9d0aa645ff7> in <module>
      2
      3 frame.plot(molniya)
----> 4 frame.plot(Orbit.from_body_ephem(Earth))

~/Development/poliastro/poliastro-library/src/poliastro/plotting/_base.py in plot(self, orbit, label, color)
    133             color = next(self._color_cycle)
    134
--> 135         self._set_attractor(orbit.attractor)
    136
    137         label = generate_label(orbit, label)

~/Development/poliastro/poliastro-library/src/poliastro/plotting/_base.py in _set_attractor(self, attractor)
     44         elif attractor is not self._attractor:
     45             raise NotImplementedError(
---> 46                 "Attractor has already been set to {}.".format(self._attractor.name)
     47             )
     48

NotImplementedError: Attractor has already been set to Earth.
[5]:
frame = OrbitPlotter3D()

frame.plot(molniya)
frame.plot(iss)
[6]:
from poliastro.neos import neows
from poliastro.examples import iss

eros = neows.orbit_from_name('eros')
[7]:
frame = OrbitPlotter3D()

frame.plot(Orbit.from_body_ephem(Earth), label=Earth)
frame.plot(eros, label='eros')
/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/twobody/orbit.py:608: UserWarning:

Frame <class 'astropy.coordinates.builtin_frames.icrs.ICRS'> does not support 'obstime', time values were not returned

[8]:
from astropy.coordinates import get_body_barycentric_posvel
from poliastro.util import time_range
[9]:
date_launch = time.Time('2011-11-26 15:02', scale='utc')
date_arrival = time.Time('2012-08-06 05:17', scale='utc')

rr_earth, _ = get_body_barycentric_posvel("earth", time_range(date_launch, end=date_arrival, periods=50))
[10]:
frame = OrbitPlotter3D()

frame.set_attractor(Sun)
frame.plot(Orbit.from_body_ephem(Earth), label=Earth)
frame.plot_trajectory(rr_earth, label=Earth)
[11]:
frame = OrbitPlotter3D()

frame.plot(eros, label='eros')
frame.plot_trajectory(rr_earth, label=Earth)