RelativeOrbit Class
The ParentChildOrbit class is designed to create 3D orbital plots for parent-child celestial object systems.
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 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.
Setting Orbit Transparency
orbit_transparency_parent_object
,orbit_transparency_child_object
(float): Transparency of orbit lines (0.0 to 1.0) for the parent and child objects.
Control the transparency of the plotted orbit lines for the parent and child objects separately. A value of 0.0 means fully transparent, while 1.0 means fully opaque.
Setting Object Colors
color_parent_object_orbit
,color_child_object_orbit
(list): Colors for the parent and child object and their orbits (e.g., ["blue", "green"]).
Specify the colors for the parent and child objects as well as their respective orbit lines.
Setting Object Sizes
sun_size
,parent_object_size
,child_object_size
(int): Sizes of the Sun, parent object, and child object in the plot.
Customize the size of the Sun, parent object, and child object in the plot using these methods.
Data Input and Plot Generation
Generating Orbital Plot
plot_steps
(int): Number of steps for plotting the orbit.n_orbits_child
(int): Number of orbital periods to plot for the child object (default is 1).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).child_trajectory
(bool): Whether to plot the child object's trajectory (default is True).n_orbits_parent
(int): Number of orbital periods to plot for the parent object (default is 1).
Use this method to generate 3D orbital plots for parent-child celestial object systems. 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
,y_lim
,z_lim
(list): Lists containing the X, Y, and Z axis limits (optional).x_label
,y_label
,z_label
(str): Labels for the X, Y, and Z axes (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.
Example Usage
This example demonstrates the usage of the ParentChildOrbit
class to create a customized 3D orbital plot and animate it. It includes setting plot styles, specifying orbital parameters, and generating the animation.
Please note that this documentation provides an overview of the ParentChildOrbit
class and its methods. Additional details can be found in the inline comments within the class implementation.
Last updated