poliastro.plotting.orbit.plotter

A module containing different orbit related plotters.

Module Contents

Classes

Trajectory

A class for collecting all information of a body within a plotter.

OrbitPlotter

A base class containing common attributes and methods for plotters.

class poliastro.plotting.orbit.plotter.Trajectory

Bases: namedtuple('Trajectory', ['coordinates', 'position', 'colors', 'dashed', 'label'])

A class for collecting all information of a body within a plotter.

Information contains all the trajectory coordinates, the current position, the name of the label to be displayed in the plotter, the color to be used and if dashed mode is desired or not.

__add__()

Return self+value.

__contains__()

Return key in self.

__delattr__()

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__()

Return self==value.

__format__()

Default object formatter.

__ge__()

Return self>=value.

__getattribute__()

Return getattr(self, name).

__getitem__()

Return self[key].

__getnewargs__()
__gt__()

Return self>value.

__hash__()

Return hash(self).

__iter__()

Implement iter(self).

__le__()

Return self<=value.

__len__()

Return len(self).

__lt__()

Return self<value.

__mul__()

Return self*value.

__ne__()

Return self!=value.

__reduce__()

Helper for pickle.

__reduce_ex__()

Helper for pickle.

__repr__()

Return repr(self).

__rmul__()

Return value*self.

__setattr__()

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

count()

Return number of occurrences of value.

index()

Return first index of value.

Raises ValueError if the value is not present.

class poliastro.plotting.orbit.plotter.OrbitPlotter(backend=None, num_points=150, *, plane=None, length_scale_units=u.km)

A base class containing common attributes and methods for plotters.

property backend

Backend instance used by the plotter.

Returns

An instance of OrbitPlotterBackend used for rendendering the scene.

Return type

OrbitPlotterBackend

property plane

Reference plane to be used when drawing the scene.

Returns

Reference plane to be used when drawing the scene. Default to

Return type

Plane, optional

property trajectories

List with all the Trajectory instances used in the plotter.

Returns

A list containing all the trajectories rendered in the scene.

Return type

List[Trajectory]

property length_scale_units

Units of length used for representing distances.

Returns

length_units – Desired length units to be used when representing distances.

Return type

Unit

set_attractor(attractor)

Set the desired plotting attractor.

Parameters

attractor (Body) – Central body.

Raises

NotImplementedError – Raised if attractor is already set.

set_orbit_frame(orbit)

Set the perifocal frame based on an orbit.

Parameters

orbit (Orbit) – Orbit to use as frame.

set_body_frame(body, epoch=None)

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

Parameters
plot(orbit, *, color=None, label=None, trail=False, dashed=True)

Plot state and osculating orbit in their plane.

Parameters
  • orbit (Orbit) – Orbit to plot.

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

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

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

  • dashed (bool, optional) – True to use a dashed line style. False otherwise.

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

Plot 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(ephem, epoch=None, *, label=None, color=None, trail=False)

Plot Ephem object over its sampling period.

Parameters
  • ephem (Ephem) – Ephemerides to plot.

  • epoch (astropy.time.Time, optional) – Epoch of the current position, None is 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_maneuver(initial_orbit, maneuver, label=None, color=None, trail=False)

Plot 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_coordinates(coordinates, *, position=None, label=None, color=None, trail=False, dashed=False)

Plot a precomputed trajectory.

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.

  • dashed (bool, optional) – True to use a dashed line style. False otherwise.

Raises

ValueError – An attractor must be set first.

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

Plot a precomputed trajectory.

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.

  • dashed (bool, optional) – True to use a dashed line style. False otherwise.

Raises

ValueError – An attractor must be set first.

set_view(elevation_angle, azimuth_angle, distance=5 * u.km)

Change 3D view by setting the elevation, azimuth and distance.

Parameters
  • elevation_angle (Quantity) – Desired elevation angle of the camera.

  • azimuth_angle (Quantity) – Desired azimuth angle of the camera.

  • distance (optional, Quantity) – Desired distance of the camera to the scene.

show()

Render the plot.