poliastro.plotting.interactive

Interactive orbit plotters.

Module Contents

Classes

OrbitPlotter3D

OrbitPlotter3D class.

OrbitPlotter2D

OrbitPlotter2D class.

class poliastro.plotting.interactive.OrbitPlotter3D(figure=None, dark=False, *, num_points=150, plane=None, unit=u.km)

Bases: _PlotlyOrbitPlotter

OrbitPlotter3D class.

plot(self, orbit, *, label=None, color=None, trail=False)

Plots state and osculating orbit in their plane.

Parameters
  • orbit (Orbit) – Orbit to plot.

  • label (str, optional) – Label of the orbit.

  • color (str, optional) – Color of the line and the position.

  • trail (bool, optional) – Fade the orbit trail, default to False.

set_view(self, elev, azim, distance=5 * u.km)

Changes 3D view.

plot_trajectory(self, coordinates, *, label=None, color=None, trail=False)

Plots a precomputed trajectory.

An attractor must be set first.

Parameters
  • coordinates (CartesianRepresentation) – Trajectory to plot.

  • label (str, optional) – Label of the trajectory.

  • color (str, optional) – Color of the trajectory.

  • trail (bool, optional) – Fade the orbit trail, default to False.

plot_maneuver(self, initial_orbit, maneuver, label=None, color=None, trail=False)

Plots the maneuver trajectory applied to the provided initial orbit.

Parameters
  • initial_orbit (Orbit) – The base orbit for which the maneuver will be applied.

  • maneuver (Maneuver) – The maneuver to be plotted.

  • label (str, optional) – Label of the trajectory.

  • color (str, optional) – Color of the trajectory.

  • trail (bool, optional) – Fade the orbit trail, default to False.

plot_body_orbit(self, body, epoch, *, label=None, color=None, trail=False)

Plots complete revolution of body and current position.

Parameters
  • body (poliastro.bodies.SolarSystemPlanet) – Body.

  • epoch (astropy.time.Time) – Epoch of current position.

  • label (str, optional) – Label of the orbit, default to the name of the body.

  • color (str, optional) – Color of the line and the position.

  • trail (bool, optional) – Fade the orbit trail, default to False.

plot_ephem(self, ephem, epoch=None, *, label=None, color=None, trail=False)

Plots Ephem object over its sampling period.

Parameters
  • ephem (Ephem) – Ephemerides to plot.

  • epoch (astropy.time.Time, optional) – Epoch of the current position, none will be used if not given.

  • label (str, optional) – Label of the orbit, default to the name of the body.

  • color (str, optional) – Color of the line and the position.

  • trail (bool, optional) – Fade the orbit trail, default to False.

show(self)

Shows the plot in the Notebook.

Updates the layout and returns the underlying figure.

property trajectories(self)
property plane(self)
set_attractor(self, attractor)

Sets plotting attractor.

Parameters

attractor (Body) – Central body.

class poliastro.plotting.interactive.OrbitPlotter2D(figure=None, *, num_points=150, plane=None, unit=u.km)

Bases: _PlotlyOrbitPlotter, poliastro.plotting._base.Mixin2D

OrbitPlotter2D class.

New in version 0.9.0.

plot_trajectory(self, coordinates, *, label=None, color=None, trail=False)

Plots a precomputed trajectory.

An attractor must be set first.

Parameters
  • coordinates (CartesianRepresentation) – Trajectory to plot.

  • label (str, optional) – Label of the trajectory.

  • color (str, optional) – Color of the trajectory.

  • trail (bool, optional) – Fade the orbit trail, default to False.

plot_ephem(self, ephem, epoch=None, *, label=None, color=None, trail=False)

Plots Ephem object over its sampling period.

Parameters
  • ephem (Ephem) – Ephemerides to plot.

  • epoch (astropy.time.Time, optional) – Epoch of the current position, none will be used if not given.

  • label (str, optional) – Label of the orbit, default to the name of the body.

  • color (str, optional) – Color of the line and the position.

  • trail (bool, optional) – Fade the orbit trail, default to False.

plot(self, orbit, *, label=None, color=None, trail=False)

Plots state and osculating orbit in their plane.

Parameters
  • orbit (Orbit) – Orbit to plot.

  • label (str, optional) – Label of the orbit.

  • color (str, optional) – Color of the line and the position.

  • trail (bool, optional) – Fade the orbit trail, default to False.

plot_body_orbit(self, body, epoch, plane=Planes.EARTH_ECLIPTIC, *, label=None, color=None, trail=False)

Plots complete revolution of body and current position.

Parameters
  • body (poliastro.bodies.SolarSystemPlanet) – Body.

  • epoch (astropy.time.Time) – Epoch of current position.

  • plane (Planes) – Reference plane.

  • label (str, optional) – Label of the orbit, default to the name of the body.

  • color (str, optional) – Color of the line and the position.

  • trail (bool, optional) – Fade the orbit trail, default to False.

plot_maneuver(self, initial_orbit, maneuver, label=None, color=None, trail=False)

Plots the maneuver trajectory applied to the provided initial orbit.

Parameters
  • initial_orbit (Orbit) – The base orbit for which the maneuver will be applied.

  • maneuver (Maneuver) – The maneuver to be plotted.

  • label (str, optional) – Label of the trajectory.

  • color (str, optional) – Color of the trajectory.

  • trail (bool, optional) – Fade the orbit trail, default to False.

show(self)

Shows the plot in the Notebook.

Updates the layout and returns the underlying figure.

property trajectories(self)
property plane(self)
set_attractor(self, attractor)

Sets plotting attractor.

Parameters

attractor (Body) – Central body.

set_frame(self, p_vec, q_vec, w_vec)

Sets perifocal frame.

Raises

ValueError – If the vectors are not a set of mutually orthogonal unit vectors.

set_orbit_frame(self, orbit)

Sets perifocal frame based on an orbit.

Parameters

orbit (Orbit) – Orbit to use as frame.

set_body_frame(self, body, epoch=None)

Sets perifocal frame based on the orbit of a body at a particular epoch if given.

Parameters