3D Trajectory Visualization¶
plot_trajectory_3d
¶
plot_trajectory_3d(trajectories, time_range=None, units='km', normalize=False, view_azimuth=45.0, view_elevation=30.0, view_distance=None, show_earth=True, earth_texture='simple', backend='matplotlib') -> object
Plot 3D trajectory in ECI frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trajectories
|
list of dict
|
List of trajectory groups, each with: - trajectory: OrbitTrajectory or numpy array [N×3] or [N×6] (positions in ECI) - color (str, optional): Line color - line_width (float, optional): Line width - label (str, optional): Legend label |
required |
time_range
|
tuple
|
(start_epoch, end_epoch) to filter data |
None
|
units
|
str
|
'm' or 'km'. Default: 'km' |
'km'
|
normalize
|
bool
|
Normalize to Earth radii. Default: False |
False
|
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 from origin. Default: Auto |
None
|
show_earth
|
bool
|
Show Earth sphere at origin. Default: True |
True
|
earth_texture
|
str
|
'blue_marble', 'simple', or None. Default: 'simple' |
'simple'
|
backend
|
str
|
'matplotlib' or 'plotly'. Default: 'matplotlib' |
'matplotlib'
|
Returns:
| Type | Description |
|---|---|
object
|
Generated figure object |
Example
import brahe as bh
import numpy as np
# Create trajectory
eop = bh.FileEOPProvider.from_default_standard(bh.EarthOrientationFileType.STANDARD, True)
bh.set_global_eop_provider(eop)
epoch = bh.Epoch.from_datetime(2024, 1, 1, 0, 0, 0.0, 0.0, bh.TimeSystem.UTC)
oe = np.array([bh.R_EARTH + 500e3, 0.01, np.radians(97.8), 0.0, 0.0, 0.0])
state = bh.state_osculating_to_cartesian(oe, bh.AngleFormat.RADIANS)
prop = bh.KeplerianPropagator.from_eci(epoch, state, 60.0)
traj = prop.propagate(epoch, epoch + bh.orbital_period(oe[0]), 60.0)
# Plot 3D trajectory
fig = bh.plot_trajectory_3d(
[{"trajectory": traj, "color": "red", "label": "LEO Orbit"}],
units='km',
show_earth=True,
backend='matplotlib'
)