poliastro2.plotting.orbit

Description

This subpackage focuses on plotting routines specifically for orbital data. It provides utilities to visualize orbits and related parameters.

Modules

  • plotter: Functions for plotting orbital trajectories.

  • backends: Subpackage collecting all support orbit plotter backends.

class poliastro2.plotting.orbit.OrbitPlotter(backend=None, num_points=150, *, plane=None, length_scale_units=Unit('km'))

A base class containing common attributes and methods for plotters.

_add_trajectory(trajectory)

Add a new trajectory to the scene.

Parameters:

trajectory (Trajectory) – An object for modeling trajectories.

Returns:

  • trace_coordinates (object) – An object representing the trace of the coordinates in the scene.

  • trace_position (object) – An object representing the trace of the position in the scene.

_create_trajectory(coordinates, position, *, colors=None, dashed=False, label=None)

Create a new Trajectory instance.

Parameters:
  • coordinates (CartesianRepresentation) – Trajectory to plot.

  • position (ndarray, optional) – Position of the body along its orbit.

  • colors (str, optional) – A list of colors for the points of the trajectory.

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

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

Returns:

An object for modeling trajectories.

Return type:

Trajectory

_plot_attractor()

Plot the scene attractor.

Notes

This method allows to select a sensible value for the radius of the attractor.

_project(vec)

Project the vector into the frame of the orbit plotter.

Parameters:

vec (ndarray) – The vector to be projected into the frame of the orbit plotter.

Returns:

A tuple containing the x, y, and z coordinates of the vector projected into the frame of the orbit plotter.

Return type:

tuple(float, float, float)

_redraw()

Redraw the the whole scene.

_unplot_attractor()

Remove the attractor from the scene.

property backend

Backend instance used by the plotter.

Returns:

An instance of OrbitPlotterBackend used for rendendering the scene.

Return type:

OrbitPlotterBackend

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

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

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_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_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_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_attractor(attractor)

Set the desired plotting attractor.

Parameters:

attractor (Body) – Central body.

Raises:

NotImplementedError – Raised if attractor is already set.

set_body_frame(body, epoch=None)

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

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

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

set_orbit_frame(orbit)

Set the perifocal frame based on an orbit.

Parameters:

orbit (Orbit) – Orbit to use as frame.

set_view(elevation_angle, azimuth_angle, distance=<Quantity 5. 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.

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]

Modules

backends

Description This subpackage collecting all support orbit plotter backends.

plotter

A module containing different orbit related plotters.