3D Stem
Hydrogen Emission Spectrum
Atomic physics visualization of hydrogen Balmer series spectral emission lines.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Atomic spectral emission lines
wavelengths = np.array([410.2, 434.0, 486.1, 656.3, 486.1]) # Hydrogen Balmer series (nm)
intensity = np.array([0.3, 0.5, 0.8, 1.0, 0.7])
# Convert to energy-like coordinates
x = (wavelengths - 400) / 300
y = np.sin(np.linspace(0, np.pi, len(wavelengths)))
z = intensity
fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')
# Create stems for each spectral line with appropriate color
colors_wl = ['#8b5cf6', '#3b82f6', '#06b6d4', '#ef4444', '#06b6d4']
for i in range(len(x)):
ax.plot([x[i], x[i]], [y[i], y[i]], [0, z[i]], color=colors_wl[i], linewidth=3, alpha=0.8)
ax.scatter([x[i]], [y[i]], [z[i]], color=colors_wl[i], s=100)
ax.set_xlabel('Wavelength (normalized)', color='white', fontsize=10)
ax.set_ylabel('Transition', color='white', fontsize=10)
ax.set_zlabel('Intensity', color='white', fontsize=10)
ax.set_title('Hydrogen Emission Spectrum', 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=25, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Stem examples
☕