3D Stem
Gravitational Wave Detections
Astrophysics visualization of LIGO/Virgo gravitational wave events by frequency and strain.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(369)
# Gravitational wave detections
n = 18
frequency = np.random.uniform(30, 300, n) # Hz
strain = np.random.exponential(1e-22, n)
snr = np.random.uniform(8, 30, n)
# Normalize for display
x = (frequency - 30) / 270
y = np.log10(strain / 1e-23)
z = snr / 30
fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')
markerline, stemlines, baseline = ax.stem(x, y, z, linefmt='-', markerfmt='o', basefmt=' ')
plt.setp(stemlines, color='#a855f7', linewidth=2, alpha=0.8)
plt.setp(markerline, color='#c084fc', markersize=9)
ax.set_xlabel('Frequency (norm)', color='white', fontsize=10)
ax.set_ylabel('log₁₀(Strain)', color='white', fontsize=10)
ax.set_zlabel('SNR (norm)', color='white', fontsize=10)
ax.set_title('Gravitational Wave Detections', 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=20, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Stem examples
☕