3D Surface

Steady-State Heat Distribution

Solution to 2D heat equation showing temperature distribution on a plate.

Output
Steady-State Heat Distribution
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

colors = ['#1e3a8a', '#3b82f6', '#22d3ee', '#fde047', '#f97316', '#dc2626']
cmap = LinearSegmentedColormap.from_list('thermal', colors, N=256)

X = np.linspace(0, 10, 80)
Y = np.linspace(0, 10, 80)
X, Y = np.meshgrid(X, Y)

# Heat equation solution with boundary conditions
Z = np.sin(np.pi*X/10) * np.sin(np.pi*Y/10) * np.exp(-0.1*(X+Y))
Z = (Z - Z.min()) / (Z.max() - Z.min()) * 100  # Scale to temperature

fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')

surf = ax.plot_surface(X, Y, Z, cmap=cmap, linewidth=0, antialiased=True)

ax.set_xlabel('X (cm)', color='#1f2937', fontsize=10)
ax.set_ylabel('Y (cm)', color='#1f2937', fontsize=10)
ax.set_zlabel('Temperature (°C)', color='#1f2937', fontsize=10)
ax.set_title('Steady-State Heat Distribution', color='#1f2937', fontsize=14, fontweight='bold', pad=20)

ax.tick_params(colors='#6b7280', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#e5e7eb')
ax.yaxis.pane.set_edgecolor('#e5e7eb')
ax.zaxis.pane.set_edgecolor('#e5e7eb')

ax.view_init(elev=30, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support