Draws one line per body through every recorded position. This is the quickest way to look at a simulation.
The plot is 2D or 3D depending on the data. If every z value in sim_data is zero, the motion is planar and a matplotlib plot of y against x is drawn. If any z value is non-zero, the work is handed to plot_orbits_3d, which returns an interactive plotly figure. Use three_d to force one or the other.
Parameters
Name
Type
Description
Default
sim_data
DataFrame
The output of simulate_system (pandas or polars). It must have the columns id, x, y and z, with positions in meters. The 3D plot also uses time, in seconds.
required
three_d
bool
None (the default) picks 3D only when there is motion in z. True forces a 3D plotly figure even for planar data. False forces a 2D plot, which shows the projection onto the x-y plane.
None
ax
matplotlib.axes.Axes
Axes to draw the 2D plot on. By default a new 7 by 7 inch figure is created. Ignored when the plot is 3D.
None
Returns
Name
Type
Description
matplotlib.axes.Axes or plotly.graph_objects.Figure
The matplotlib Axes for a 2D plot, with an equal aspect ratio, axes labelled in meters and a legend of body names. A plotly Figure for a 3D plot.