SimpleOrbit Class
This class gives you the ability to plot orbits in singles, or using an array/list.
Class Initialization
plot_title
(str): The title of the orbital plot.name
(str): The name of the celestial object you want to plot.fps
(int): Frames per second for the animation (default is 30).
This class is initialized with a plot title, object name, and an optional frames per second value for the animation.
Plot Styling
Setting Background Color
face_color
(str): Background color of the 3D plot.
Set the background color of the plot using this method. You can specify the color as a name (e.g., "white") or a hexadecimal code (e.g., "#F3EEEA").
Setting Axes Plane Color
pane_color
(str): Color of the axes planes.
Change the color of the planes representing the X, Y, and Z axes using this method.
Setting Grid Color
grid_color
(str): Color of grid lines.
Customize the color of the grid lines in the 3D plot to provide reference points.
Setting Orbit Transparency
orbit_transparency
(float): Transparency of orbit lines (0.0 to 1.0).
Control the transparency of the plotted orbit lines. A value of 0.0 means fully transparent, while 1.0 means fully opaque.
Setting Label Color
label_color
(str): Color of axis labels.
Customize the color of the X, Y, and Z axis labels for better visibility or style matching.
Setting Tick Color
tick_color
(str): Color of axis ticks.
Specify the color of the ticks on the X, Y, and Z axes to align them with the plot's style.
Data Input and Plot Generation
Generating Orbital Plot
plot_steps
(int): Number of steps for plotting the orbit.n_orbits
(int): Number of orbital periods to plot.data
(list of lists): List of celestial objects' data. Each sublist should contain the name, semi-major axis, perihelion, eccentricity, inclination, longitude of ascending node, argument of perihelion, and color (optional).color
(str): Default color for celestial objects (optional).trajectory
(bool): Whether to plot the object's trajectory (default is False).sun
(bool): Whether to plot the Sun at the center (default is True).inclinationObserver
(bool): Visualize the inclination of the orbitsdisplay_name
(bool): Enable the names/IDs of the objects you are plotting.
Use this method to generate 3D orbital plots. You can either provide a list of celestial object data or specify the orbital parameters individually for a single object.
Animating the Orbit
dpi
(int): Dots per inch for the animation.save
(bool): Whether to save the animation as a GIF (default is False).export_zoom
(int): Zoom level for the exported GIF (optional).font_size
(str): Font size for the legend (optional).export_folder
(str): Folder to save the GIF (optional).animation_interval
(int): Interval between animation frames (default is 40).x_lim
(list): List containing the X-axis limits (optional).y_lim
(list): List containing the Y-axis limits (optional).z_lim
(list): List containing the Z-axis limits (optional).x_label
(str): Label for the X-axis (optional).y_label
(str): Label for the Y-axis (optional).z_label
(str): Label for the Z-axis (optional).
This method animates the generated orbital plot. You can specify various parameters like export settings, axis labels, and animation interval.
Setting Axis Limits
x_lim
,y_lim
,z_lim
(list): Lists containing axis limits.
You can use these methods to set custom limits for the X, Y, and Z axes to focus on specific regions of the plot.
Setting Axis Labels
x_label
,y_label
,z_label
(str): Labels for the X, Y, and Z axes.
Use these methods to label the axes in the plot with the desired text.
Individual Object Details
You can set individual orbital parameters for a single object using the following methods:
semi_major_axis
: Semi-major axis of the object's orbit.perihelion
: Perihelion distance of the object's orbit.eccentricity
: Eccentricity of the object's orbit.inclination
: Inclination of the object's orbit.longitude_of_ascending_node
: Longitude of the ascending node of the object's orbit.argument_of_perihelion
: Argument of perihelion of the object's orbit.sun_size
: Size of the Sun in the plot.planet_size
: Size of the celestial object in the plot.
Inclination Plot
color
(str): Color of the inclination plot.
Use this method to enable plotting of inclination and specify the color for the inclination plot.
Example Usage
This example demonstrates how to create and customize orbital plots using the SimpleOrbit
class. You can define data for multiple celestial objects or set parameters individually for a single object, style the plot, and generate an animated orbit visualization.
Last updated