koe_hist_2d
- ssapy.plotUtils.koe_hist_2d(stable_data, title='Initial orbital elements of\n1 year stable cislunar orbits', limits=[1, 50], bins=200, logscale=False, cmap='coolwarm', save_path=False)[source][source]
Create a 2D histogram plot for various Keplerian orbital elements of stable cislunar orbits.
Parameters: - stable_data (object): An object with attributes a, e, i, and ta, which are arrays of semi-major axis, eccentricity, inclination, and true anomaly, respectively. - title (str, optional): Title of the figure. Default is “Initial orbital elements of
- 1 year stable cislunar orbits”.
limits (list, optional): Color scale limits for the histogram. Default is [1, 50].
bins (int, optional): Number of bins for the 2D histograms. Default is 200.
logscale (bool or str, optional): Whether to use logarithmic scaling for the color bar. Default is False. Can also be ‘log’ to apply logarithmic scaling.
cmap (str, optional): Colormap to use for the histograms. Default is ‘coolwarm’.
save_path (str, optional): Path to save the generated plot. If not provided, the plot will not be saved. Default is False.
Returns: - fig (matplotlib.figure.Figure): The figure object containing the 2D histograms.
This function creates a 3x3 grid of 2D histograms showing the relationships between various orbital elements, including semi-major axis, eccentricity, inclination, and true anomaly. The color scale of the histograms can be adjusted with a logarithmic or linear normalization. The plot is customized with labels and a color bar.
Example usage: ``` import numpy as np from your_module import koe_hist_2d
# Example data class StableData:
- def __init__(self):
self.a = np.random.uniform(1, 20, 1000) self.e = np.random.uniform(0, 1, 1000) self.i = np.radians(np.random.uniform(0, 90, 1000)) self.ta = np.radians(np.random.uniform(0, 360, 1000))
stable_data = StableData() koe_hist_2d(stable_data, save_path=’orbit_histograms.pdf’) ```