3D Surface
Two-Source Wave Interference
Interference pattern from two point wave sources showing constructive and destructive zones.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
colors = ['#0a0a0f', '#0c4a6e', '#0891b2', '#22d3ee']
cmap = LinearSegmentedColormap.from_list('ocean', colors, N=256)
X = np.linspace(-5, 5, 100)
Y = np.linspace(-5, 5, 100)
X, Y = np.meshgrid(X, Y)
# Two-source interference pattern
R1 = np.sqrt((X-1)**2 + Y**2)
R2 = np.sqrt((X+1)**2 + Y**2)
Z = np.sin(R1*3) + np.sin(R2*3)
fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')
surf = ax.plot_surface(X, Y, Z, cmap=cmap, linewidth=0, antialiased=True)
ax.set_xlabel('X', color='white', fontsize=10)
ax.set_ylabel('Y', color='white', fontsize=10)
ax.set_zlabel('Amplitude', color='white', fontsize=10)
ax.set_title('Two-Source Wave Interference', 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=30, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Surface examples
☕