Skip to content

Synodic Frame Trajectory Plots

plot_synodic_3d

plot_synodic_3d(trajectories, *, frame='EMR', reference_epoch=None, bodies=None, units='km', view_azimuth=45.0, view_elevation=30.0, view_distance=None, sphere_resolution_lon=360, sphere_resolution_lat=180, backend='matplotlib', width=None, height=None) -> object

Plot 3D trajectories in a synodic (two-body rotating) frame.

Each trajectory is converted to its ECI representation and then transformed per-epoch into the requested synodic frame via state_frame_to_frame. The frame's primary and secondary bodies are drawn as textured spheres at their synodic-frame positions at a single reference epoch (the rotating frame keeps both bodies on the x-axis at all times, so one epoch is sufficient to place them).

Parameters:

Name Type Description Default
trajectories list of dict

List of trajectory groups, each with: - trajectory: OrbitTrajectory - color (str, optional): Line color - line_width (float, optional): Line width - label (str, optional): Legend label

required
frame str or CelestialFrame

Synodic frame to plot in. Either 'EMR', 'SER', 'GSE', a CelestialFrame name string, or a CelestialFrame.Synodic(origin, primary, secondary). Default: 'EMR'

'EMR'
reference_epoch Epoch

Epoch at which the primary and secondary body spheres are placed. Default: the first epoch of the first trajectory

None
bodies list of dict

Extra textured spheres to draw in addition to the frame's primary/secondary, each with: - position (array-like, length 3): Position in meters, in the synodic frame - radius (float): Radius in meters - texture (str, Path, or None, optional): Texture (plotly only) - name (str): Label used in the legend/hover text

None
units str

'm' or 'km'. Default: 'km'

'km'
view_azimuth float

Camera azimuth angle (degrees). Default: 45.0

45.0
view_elevation float

Camera elevation angle (degrees). Default: 30.0

30.0
view_distance float

Camera distance multiplier. Default: 2.5 (larger = further out)

None
sphere_resolution_lon int

Longitude resolution for textured sphere (plotly only). Higher values = better quality but slower rendering, with a larger output file (the textured sphere is encoded as a per-face-colored Mesh3d). Default: 360

360
sphere_resolution_lat int

Latitude resolution for textured sphere (plotly only). Higher values = better quality but slower rendering, with a larger output file (the textured sphere is encoded as a per-face-colored Mesh3d). Default: 180

180
backend str

'matplotlib' or 'plotly'. Default: 'matplotlib'

'matplotlib'
width int

Figure width in pixels (plotly only). Default: None (responsive)

None
height int

Figure height in pixels (plotly only). Default: None (responsive)

None

Returns:

Name Type Description
object object

Generated figure (matplotlib.figure.Figure or plotly.graph_objects.Figure)

Raises:

Type Description
ValueError

If frame is not a recognized CelestialFrame name, or resolves to a CelestialFrame that is not synodic.

TypeError

If a trajectory is not an OrbitTrajectory object.

Example
import brahe as bh
import numpy as np

eop = bh.FileEOPProvider.from_default_standard(True, "Hold")
bh.set_global_eop_provider(eop)

epoch = bh.Epoch.from_datetime(2024, 3, 1, 0, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.001, 97.8, 15.0, 30.0, 45.0])
state = bh.state_koe_to_eci(oe, bh.AngleFormat.DEGREES)
prop = bh.KeplerianPropagator.from_eci(epoch, state, 60.0)
prop.propagate_to(epoch + 5400.0)

# Plot a LEO trajectory in the Earth-Moon Rotating frame
fig = bh.plot_synodic_3d(
    [{"trajectory": prop.trajectory, "label": "LEO"}],
    frame="EMR",
    backend="matplotlib",
)

plot_earth_moon_rotating_3d

plot_earth_moon_rotating_3d(trajectories, **kwargs) -> object

Plot 3D trajectories in the Earth-Moon Rotating (EMR) frame.

Alias for plot_synodic_3d(trajectories, frame=CelestialFrame.EMR, ...); accepts the same keyword arguments.

Parameters:

Name Type Description Default
trajectories list of dict

Same trajectory-group input as plot_synodic_3d.

required
**kwargs dict

Forwarded to plot_synodic_3d.

{}

Returns:

Name Type Description
object object

Generated figure object.

Example
import brahe as bh
import numpy as np

eop = bh.FileEOPProvider.from_default_standard(True, "Hold")
bh.set_global_eop_provider(eop)

epoch = bh.Epoch.from_datetime(2024, 3, 1, 0, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.001, 97.8, 15.0, 30.0, 45.0])
state = bh.state_koe_to_eci(oe, bh.AngleFormat.DEGREES)
prop = bh.KeplerianPropagator.from_eci(epoch, state, 60.0)
prop.propagate_to(epoch + 5400.0)

fig = bh.plot_earth_moon_rotating_3d(
    [{"trajectory": prop.trajectory, "label": "LEO"}], backend="matplotlib"
)

See Also