3D Fill Between
Wave Interference Pattern
3D visualization of two interfering waves with orange, cyan and lime
Output
Python
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(10, 8), facecolor='white')
ax = fig.add_subplot(111, projection='3d')
ax.set_facecolor('white')
# Wave parameters
n = 100
t = np.linspace(0, 4*np.pi, n)
# Wave 1
x1 = t
y1 = np.sin(t)
z1 = np.zeros(n)
# Wave 2
x2 = t
y2 = np.sin(t + np.pi/2) * 0.8
z2 = np.ones(n) * 2
# Combined wave
x3 = t
y3 = np.sin(t) + np.sin(t + np.pi/2) * 0.8
z3 = np.ones(n) * 4
ax.plot(x1, y1, z1, linewidth=3, color='#F54927', label='Wave 1')
ax.plot(x2, y2, z2, linewidth=3, color='#27D3F5', label='Wave 2')
ax.plot(x3, y3, z3, linewidth=3.5, color='#6CF527', label='Combined')
# Connection lines showing interference
for i in range(0, n, 6):
ax.plot([x1[i], x3[i]], [y1[i], y3[i]], [z1[i], z3[i]],
color='#F5D327', alpha=0.25, linewidth=0.6)
ax.set_xlabel('Time', fontsize=11, color='#1f2937')
ax.set_ylabel('Amplitude', fontsize=11, color='#1f2937')
ax.set_zlabel('Layer', fontsize=11, color='#1f2937')
ax.set_title('Wave Interference Pattern', fontsize=14, color='#1f2937', fontweight='bold', pad=15)
ax.legend(loc='upper left', fontsize=9)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#000000')
ax.yaxis.pane.set_edgecolor('#000000')
ax.zaxis.pane.set_edgecolor('#000000')
ax.tick_params(colors='#000000', labelsize=9)
ax.grid(True, alpha=0.5, linewidth=0.5)
ax.xaxis._axinfo['grid']['color'] = '#000000'
ax.yaxis._axinfo['grid']['color'] = '#000000'
ax.zaxis._axinfo['grid']['color'] = '#000000'
ax.view_init(elev=20, azim=30)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Fill Between examples
☕