Line & Scatter
Dual Wave Interference
Two overlapping waves with blend effect.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'wave1': '#06B6D4', # Cyan
'wave2': '#F97316', # Orange
'background': '#0F172A',
'text': '#E2E8F0',
'grid': '#334155',
}
# === DATA ===
x = np.linspace(0, 10, 200)
y1 = 4 + 2 * np.sin(1.5 * x)
y2 = 4 + 2 * np.sin(1.5 * x + 2)
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
# Wave 1 with glow
for lw, alpha in [(12, 0.03), (8, 0.06), (5, 0.12), (2.5, 1.0)]:
ax.plot(x, y1, color=COLORS['wave1'], linewidth=lw, alpha=alpha)
# Wave 2 with glow
for lw, alpha in [(12, 0.03), (8, 0.06), (5, 0.12), (2.5, 1.0)]:
ax.plot(x, y2, color=COLORS['wave2'], linewidth=lw, alpha=alpha)
# Intersection points
intersect_mask = np.abs(y1 - y2) < 0.1
ax.scatter(x[intersect_mask], y1[intersect_mask], s=100,
color='white', alpha=0.8, zorder=5)
# === AXES ===
ax.set_xlim(0, 10)
ax.set_ylim(0, 8)
ax.set_xlabel('Phase', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Amplitude', fontsize=10, color=COLORS['text'], labelpad=10)
# === STYLING ===
for spine in ax.spines.values():
spine.set_visible(False)
ax.yaxis.grid(True, color=COLORS['grid'], linewidth=0.5, alpha=0.3)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text'], labelsize=9, length=0, pad=8)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Line & Scatter examples
☕