Plotting in 3D

[1]:
import numpy as np

from poliastro.bodies import Earth, Sun
from poliastro.constants import J2000
from poliastro.examples import churi, iss, molniya
from poliastro.plotting import OrbitPlotter3D
from poliastro.twobody import Orbit
[2]:
# More info: https://plotly.com/python/renderers/
import plotly.io as pio

pio.renderers.default = "plotly_mimetype+notebook_connected"
[3]:
churi.plot(interactive=True, use_3d=True)
[4]:
frame = OrbitPlotter3D()

frame.plot(churi)
frame.plot_body_orbit(Earth, J2000)
[5]:
frame = OrbitPlotter3D()

frame.plot(molniya)
frame.plot(iss)
[6]:
eros = Orbit.from_sbdb("eros")

frame = OrbitPlotter3D()

frame.plot_body_orbit(Earth, J2000)
frame.plot(eros, label="eros")
[7]:
from astropy.time import Time
from poliastro.ephem import Ephem
from poliastro.util import time_range
[8]:
date_launch = Time("2011-11-26 15:02", scale="utc").tdb
date_arrival = Time("2012-08-06 05:17", scale="utc").tdb

earth = Ephem.from_body(
    Earth, time_range(date_launch, end=date_arrival, periods=50)
)
[9]:
frame = OrbitPlotter3D()
frame.set_attractor(Sun)

frame.plot_body_orbit(Earth, J2000, label=Earth)
frame.plot_ephem(earth, label=Earth)
[10]:
frame = OrbitPlotter3D()

frame.plot(eros, label="eros")
frame.plot_trajectory(earth.sample(), label=Earth)