Linear Regression Plot
Arrhenius Reaction Rate
Chemical kinetics temperature dependence with activation energy
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
np.random.seed(777)
# Arrhenius data
temp = np.linspace(280, 350, 50) # Kelvin
inv_temp = 1000 / temp
Ea = 50 # kJ/mol
A = 1e10
k = A * np.exp(-Ea * 1000 / (8.314 * temp)) * np.exp(np.random.normal(0, 0.15, 50))
log_k = np.log(k)
slope, intercept, r_value, _, _ = stats.linregress(inv_temp, log_k)
x_fit = np.linspace(2.85, 3.6, 100)
y_fit = slope * x_fit + intercept
fig, ax = plt.subplots(figsize=(10, 7), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
ax.yaxis.grid(True, color='#f0f0f0', linewidth=1, zorder=1)
ax.xaxis.grid(True, color='#f0f0f0', linewidth=1, zorder=1)
ax.fill_between(x_fit, y_fit - 0.3, y_fit + 0.3, color='#F5276C', alpha=0.1, linewidth=0, zorder=2)
ax.plot(x_fit, y_fit, color='#F5276C', linewidth=2.5, zorder=3)
ax.scatter(inv_temp, log_k, c='#27D3F5', s=60, alpha=0.85, edgecolors='white', linewidths=0.6, zorder=4)
# Activation energy from slope
Ea_calc = -slope * 8.314 / 1000
ax.text(0.03, 0.05, f'Ea = {Ea_calc:.1f} kJ/mol\nR² = {r_value**2:.4f}',
transform=ax.transAxes, fontsize=10, color='#555555', ha='left', va='bottom',
family='monospace', bbox=dict(boxstyle='round,pad=0.5', facecolor='white', edgecolor='#dddddd'))
for spine in ['top', 'right']:
ax.spines[spine].set_visible(False)
for spine in ['bottom', 'left']:
ax.spines[spine].set_color('#cccccc')
ax.set_xlabel('1000/T (K⁻¹)', fontsize=12, color='#333333', fontweight='500', labelpad=10)
ax.set_ylabel('ln(k)', fontsize=12, color='#333333', fontweight='500', labelpad=10)
ax.set_title('Arrhenius Plot', fontsize=15, color='#1a1a1a', 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
More Linear Regression Plot examples
☕