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, central_body='earth', show_body=True, texture=None, additional_bodies=None, sphere_resolution_lon=360, sphere_resolution_lat=180, backend='matplotlib', width=None, height=None) -> object
Plot 3D trajectories about a central body.
Trajectories are plotted in the central body's centered-inertial frame. A trajectory declared in any other frame is converted to it via to_frame(). Custom bodies without a NAIF ID are plotted using the trajectory's raw Cartesian position, unconverted.
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 |
time_range | tuple | (start_epoch, end_epoch) to filter data | None |
units | str | 'm' or 'km'. Default: 'km' | 'km' |
normalize | bool | Normalize distances by the central body's radius. 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 multiplier. Default: 2.5 (larger = further out) | None |
central_body | str or dict | Central body to plot trajectories around. Either a | 'earth' |
show_body | bool | Show the central body sphere at the origin. Default: True | True |
texture | str | Texture to use for the central body sphere (plotly only). Options: - 'simple': Solid lightblue sphere (fast rendering) - 'blue_marble': NASA Blue Marble texture (packaged with brahe, Earth only) - 'natural_earth_50m': Natural Earth 50m shaded relief (auto-downloads ~20MB, Earth only) - 'natural_earth_10m': Natural Earth 10m shaded relief (auto-downloads ~180MB, Earth only) - Any other | None |
additional_bodies | list of dict | Extra textured spheres to draw alongside the central body, each with: - position (array-like, length 3): Position in meters, in the same frame as the plotted trajectories - radius (float): Radius in meters - texture (str, Path, or None, optional): Texture, as for | 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 |
TypeError | If a trajectory is not an OrbitTrajectory object. |