Polar Chart

Neural Network Layer Activations

Polar visualization of neural network layer activation patterns during inference on image classification.

Output
Neural Network Layer Activations
Python
import matplotlib.pyplot as plt
import numpy as np

# Network layers and activation strengths
layers = ['Conv1', 'Pool1', 'Conv2', 'Pool2', 'Conv3', 'FC1', 'FC2', 'Output']
np.random.seed(42)
activations = [0.85, 0.72, 0.91, 0.68, 0.95, 0.88, 0.75, 0.98]

# Angles
angles = np.linspace(0, 2 * np.pi, len(layers), endpoint=False).tolist()
activations_plot = activations + [activations[0]]
angles += angles[:1]

# Dark theme
fig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(polar=True), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

# Neon glow effect
for lw, alpha in [(14, 0.06), (10, 0.12), (6, 0.25)]:
    ax.plot(angles, activations_plot, color='#F527B0', linewidth=lw, alpha=alpha)
ax.plot(angles, activations_plot, color='#F527B0', linewidth=2.5)
ax.fill(angles, activations_plot, color='#F527B0', alpha=0.15)

# Scatter with glow
for angle, val in zip(angles[:-1], activations):
    ax.scatter(angle, val, color='#F527B0', s=150, alpha=0.3, zorder=4)
    ax.scatter(angle, val, color='#F527B0', s=80, edgecolors='white', linewidth=1, zorder=5)

# Styling
ax.set_ylim(0, 1.1)
ax.set_xticks(angles[:-1])
ax.set_xticklabels(layers, fontsize=11, color='white', fontweight='500')
ax.set_yticks([0.25, 0.5, 0.75, 1.0])
ax.set_yticklabels(['0.25', '0.50', '0.75', '1.00'], fontsize=9, color='#888888')

ax.spines['polar'].set_color('#555555')
ax.grid(color='#555555', linewidth=0.8, alpha=0.7)
ax.tick_params(colors='#888888')

ax.set_title('Neural Network Activation Pattern', fontsize=16, color='white', fontweight='bold', pad=25)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Part-to-Whole

Did this help you?

Support PyLucid to keep it free & growing

Support