3D Scatter

Main Asteroid Belt Distribution

Solar system asteroid belt showing orbital distribution with varying eccentricities and inclinations.

Output
Main Asteroid Belt Distribution
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(2024)

# Asteroid belt simulation
n_asteroids = 400

# Orbital parameters
a = np.random.uniform(2.1, 3.3, n_asteroids)  # Semi-major axis (AU)
e = np.random.beta(2, 10, n_asteroids)  # Eccentricity
i = np.abs(np.random.normal(0, 10, n_asteroids))  # Inclination (degrees)

# Random orbital phase
theta = np.random.uniform(0, 2*np.pi, n_asteroids)

# Convert to cartesian
r = a * (1 - e**2) / (1 + e * np.cos(theta))
x = r * np.cos(theta)
y = r * np.sin(theta) * np.cos(np.radians(i))
z = r * np.sin(theta) * np.sin(np.radians(i))

# Size distribution (power law)
sizes = np.random.pareto(2, n_asteroids) * 10 + 5

fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')

scatter = ax.scatter(x, y, z, c=a, cmap='copper', s=sizes, alpha=0.6, edgecolors='none')

# Mark Sun
ax.scatter([0], [0], [0], c='#fbbf24', s=200, marker='o')

ax.set_xlabel('X (AU)', color='white', fontsize=10)
ax.set_ylabel('Y (AU)', color='white', fontsize=10)
ax.set_zlabel('Z (AU)', color='white', fontsize=10)
ax.set_title('Main Asteroid Belt Distribution', color='white', fontsize=14, fontweight='bold', pad=20)

ax.tick_params(colors='#64748b', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#1e293b')
ax.yaxis.pane.set_edgecolor('#1e293b')
ax.zaxis.pane.set_edgecolor('#1e293b')

ax.view_init(elev=30, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support