Linear Regression Plot

Quantum Yield vs Wavelength

Photochemistry efficiency curve with spectral annotations

Output
Quantum Yield vs Wavelength
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(333)

# Photochemistry data
wavelength = np.linspace(350, 700, 55)
# Peak around 450nm (blue light)
qy = 0.85 * np.exp(-((wavelength - 450)**2) / (2 * 60**2)) + np.random.normal(0, 0.03, 55)
qy = np.clip(qy, 0, 1)

# Smooth curve
wl_smooth = np.linspace(350, 700, 200)
qy_smooth = 0.85 * np.exp(-((wl_smooth - 450)**2) / (2 * 60**2))

fig, ax = plt.subplots(figsize=(10, 7), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

# Spectral color gradient background
from matplotlib.colors import LinearSegmentedColormap
spectral = ['#8B00FF', '#4927F5', '#27D3F5', '#6CF527', '#F5D327', '#F54927', '#9C2007']
for i, (w1, w2, c) in enumerate([(350, 400, '#8B00FF'), (400, 450, '#4927F5'), (450, 500, '#27D3F5'), 
                                   (500, 550, '#6CF527'), (550, 600, '#F5D327'), (600, 650, '#F54927'), (650, 700, '#9C2007')]):
    ax.axvspan(w1, w2, alpha=0.08, color=c, zorder=1)

ax.fill_between(wl_smooth, qy_smooth - 0.05, qy_smooth + 0.05, color='#F5276C', alpha=0.15, linewidth=0, zorder=2)
ax.plot(wl_smooth, qy_smooth, color='#F5276C', linewidth=2.5, zorder=3)
ax.scatter(wavelength, qy, c='white', s=50, alpha=0.9, edgecolors='#F5276C', linewidths=1, zorder=4)

# Peak annotation
ax.scatter([450], [0.85], c='#F5D327', s=120, marker='*', zorder=5)
ax.text(460, 0.88, 'λmax = 450 nm', fontsize=10, color='#F5D327')

for spine in ['top', 'right']:
    ax.spines[spine].set_visible(False)
for spine in ['bottom', 'left']:
    ax.spines[spine].set_color('#333333')

ax.set_xlabel('Wavelength (nm)', fontsize=12, color='white', fontweight='500', labelpad=10)
ax.set_ylabel('Quantum Yield (Φ)', fontsize=12, color='white', fontweight='500', labelpad=10)
ax.set_title('Photochemical Efficiency Spectrum', fontsize=15, color='white', fontweight='bold', pad=20, loc='left')
ax.tick_params(colors='#666666', labelsize=10, length=0)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Pairwise Data

Did this help you?

Support PyLucid to keep it free & growing

Support