Line & Scatter

Energy Burst

Explosive scatter with energy lines radiating from center.

Output
Energy Burst
Python
import matplotlib.pyplot as plt
import numpy as np

# === STYLE CONFIG ===
COLORS = {
    'core': '#FBBF24',       # Amber
    'rays': '#F97316',       # Orange  
    'particles': '#EF4444',  # Red
    'background': '#0F172A',
    'text': '#E2E8F0',
}

# === DATA ===
np.random.seed(42)
center = (5, 4)
n_rays = 16
n_particles = 40

# Ray endpoints
angles = np.linspace(0, 2*np.pi, n_rays, endpoint=False)
ray_lengths = np.random.uniform(2, 3.5, n_rays)

# Particles
particle_angles = np.random.uniform(0, 2*np.pi, n_particles)
particle_dists = np.random.uniform(0.5, 4, n_particles)
px = center[0] + particle_dists * np.cos(particle_angles)
py = center[1] + particle_dists * np.sin(particle_angles)

# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])

# === PLOT ===
# Rays with glow
for angle, length in zip(angles, ray_lengths):
    ex = center[0] + length * np.cos(angle)
    ey = center[1] + length * np.sin(angle)
    
    for lw, alpha in [(6, 0.1), (3, 0.2), (1.5, 0.5)]:
        ax.plot([center[0], ex], [center[1], ey], 
                color=COLORS['rays'], linewidth=lw, alpha=alpha)

# Particles with glow
for pxi, pyi, d in zip(px, py, particle_dists):
    size = 30 + 20 * (1 - d/4)
    for s, alpha in [(size*3, 0.1), (size*1.5, 0.2)]:
        ax.scatter([pxi], [pyi], s=s, color=COLORS['particles'], alpha=alpha)
    ax.scatter([pxi], [pyi], s=size, color=COLORS['particles'],
               edgecolors='white', linewidths=0.5)

# Core glow
for s, alpha in [(800, 0.05), (400, 0.1), (200, 0.2), (100, 0.4)]:
    ax.scatter([center[0]], [center[1]], s=s, color=COLORS['core'], alpha=alpha)
ax.scatter([center[0]], [center[1]], s=80, color=COLORS['core'],
           edgecolors='white', linewidths=2)

# === AXES ===
ax.set_xlim(0, 10)
ax.set_ylim(0, 8)
ax.set_xlabel('X', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Y', fontsize=10, color=COLORS['text'], labelpad=10)

# === STYLING ===
for spine in ax.spines.values():
    spine.set_visible(False)

ax.tick_params(axis='both', colors=COLORS['text'], labelsize=9, length=0, pad=8)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Pairwise Data

Did this help you?

Support PyLucid to keep it free & growing

Support