3D Stem

Chemical Reaction Kinetics

Chemistry visualization showing reaction rate dependence on temperature and pressure.

Output
Chemical Reaction Kinetics
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(147)

# Chemical reaction kinetics
n = 24
temperature = np.linspace(300, 500, n)
pressure = np.random.choice([1, 2, 5], n)
rate = np.exp(-5000 / temperature) * pressure * np.random.uniform(0.8, 1.2, n)

x = (temperature - 300) / 200
y = pressure / 5
z = rate / rate.max()

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='#f97316', linewidth=2, alpha=0.8)
plt.setp(markerline, color='#fb923c', markersize=8)

ax.set_xlabel('Temperature (norm)', color='white', fontsize=10)
ax.set_ylabel('Pressure (atm)', color='white', fontsize=10)
ax.set_zlabel('Reaction Rate', color='white', fontsize=10)
ax.set_title('Chemical Reaction Kinetics', 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

Did this help you?

Support PyLucid to keep it free & growing

Support