Violin Plot

Cyberpunk Violin Plot

Futuristic dark theme with neon glow effects and scan lines

Output
Cyberpunk Violin Plot
Python
import matplotlib.pyplot as plt
import numpy as np

# Data
np.random.seed(42)
channels = ['Alpha', 'Beta', 'Gamma', 'Delta', 'Theta']
data = [np.random.normal(loc, 1, 250) for loc in [4, 6, 5, 7, 5.5]]

# Cyberpunk neon colors
neon = ['#FF0080', '#00FFFF', '#FFFF00', '#FF00FF', '#00FF00']

# Create figure with dark background
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0a')
ax.set_facecolor('#0a0a0a')

vp = ax.violinplot(data, positions=range(len(data)), widths=0.75,
                   showmeans=False, showmedians=False, showextrema=False)

# Style with cyberpunk glow
for i, body in enumerate(vp['bodies']):
    body.set_facecolor(neon[i])
    body.set_edgecolor(neon[i])
    body.set_linewidth(0.5)
    body.set_alpha(0.15)
    
    # Multiple glow layers
    path = body.get_paths()[0]
    for lw, alpha in [(12, 0.05), (8, 0.1), (4, 0.2), (2, 0.4)]:
        ax.plot(path.vertices[:, 0], path.vertices[:, 1],
                color=neon[i], linewidth=lw, alpha=alpha)
    
    # Sharp outline
    ax.plot(path.vertices[:, 0], path.vertices[:, 1],
            color=neon[i], linewidth=1, alpha=0.9)

# Add glowing median markers
for i, d in enumerate(data):
    median = np.median(d)
    for size, alpha in [(200, 0.2), (100, 0.4), (50, 0.8)]:
        ax.scatter(i, median, c=neon[i], s=size, alpha=alpha, 
                   edgecolor='none', zorder=5)

# Horizontal scan lines
for y in np.arange(0, 10, 0.5):
    ax.axhline(y, color='#1a1a1a', linewidth=0.5, alpha=0.5)

# Customize axes
ax.set_xticks(range(len(channels)))
ax.set_xticklabels(channels, fontsize=11, fontweight='600', color='#FFFFFF')
ax.set_ylabel('SIGNAL AMPLITUDE', fontsize=11, fontweight='600', 
              color='#00FFFF', labelpad=10)

# Cyberpunk styling
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#333333')
ax.spines['bottom'].set_color('#333333')
ax.tick_params(colors='#888888', labelsize=10)
ax.yaxis.grid(True, linestyle='-', alpha=0.1, color='#00FFFF')

# Add corner decorations
ax.text(0.02, 0.98, '◢', transform=ax.transAxes, fontsize=16,
        color='#00FFFF', alpha=0.5, va='top')
ax.text(0.98, 0.98, '◣', transform=ax.transAxes, fontsize=16,
        color='#FF0080', alpha=0.5, va='top', ha='right')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support