poliastro.plotting

Package Contents

Classes

OrbitPlotter2D

OrbitPlotter2D class.

OrbitPlotter3D

OrbitPlotter3D class.

StaticOrbitPlotter

StaticOrbitPlotter class.

class poliastro.plotting.OrbitPlotter2D(figure=None, *, num_points=150, plane=None)

Bases: poliastro.plotting.core._PlotlyOrbitPlotter, poliastro.plotting._base.Mixin2D

OrbitPlotter2D class.

New in version 0.9.0.

abstract _redraw(self)
_draw_point(self, radius, color, name, center=[0, 0, 0] * u.km)
_draw_sphere(self, radius, color, name, center=[0, 0, 0] * u.km)
_plot_coordinates(self, coordinates, label, colors, dashed)
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 (string, optional) – Label of the trajectory.

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

  • 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 (string, optional) – Label of the orbit.

  • color (string, 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 (string, optional) – Color of the line and the position.

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

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

Bases: poliastro.plotting.core._PlotlyOrbitPlotter

OrbitPlotter3D class.

_draw_point(self, radius, color, name, center=[0, 0, 0] * u.km)
_draw_sphere(self, radius, color, name, center=[0, 0, 0] * u.km)
_plot_coordinates(self, coordinates, label, colors, dashed)
plot(self, orbit, *, label=None, color=None, trail=False)

Plots state and osculating orbit in their plane.

Parameters
  • orbit (Orbit) – Orbit to plot.

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

  • color (string, 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.

class poliastro.plotting.StaticOrbitPlotter(ax=None, num_points=150, dark=False, *, plane=None)

Bases: poliastro.plotting._base.BaseOrbitPlotter, poliastro.plotting._base.Mixin2D

StaticOrbitPlotter class.

This class holds the perifocal plane of the first Orbit plotted in it using plot(), so all following plots will be projected on that plane. Alternatively, you can call set_frame() to set the frame before plotting.

_redraw(self)
_clear_attractor(self)
_get_colors(self, color, trail)
_draw_point(self, radius, color, name, center=None)
_draw_sphere(self, radius, color, name, center=[0, 0, 0] * u.km)
_plot_coordinates(self, coordinates, label, colors, dashed)
_plot_position(self, position, label, colors)
_set_legend(self, label, line_coordinates, line_position=None)
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 (string, optional) – Label of the trajectory.

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

  • 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 (string, optional) – Label of the orbit.

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

  • 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 (string, 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 (string, optional) – Color of the line and the position.

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