3D Scatter

Network Intrusion Detection System

Cybersecurity analysis showing network traffic features with anomaly/intrusion detection.

Output
Network Intrusion Detection System
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(159)

# Network traffic features
n_connections = 200

packet_size = np.random.exponential(500, n_connections) + 50
duration = np.random.exponential(10, n_connections) + 0.1
port_entropy = np.random.uniform(0, 8, n_connections)

# Anomaly detection
is_anomaly = (packet_size > 1500) | (duration > 30) | (port_entropy > 6)
is_anomaly |= np.random.random(n_connections) < 0.05  # Random anomalies

colors = ['#F5276C' if a else '#27D3F5' for a in is_anomaly]
sizes = [80 if a else 40 for a in is_anomaly]

fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')

ax.scatter(packet_size, duration, port_entropy, c=colors, s=sizes, 
           alpha=0.7, edgecolors='#374151', linewidths=0.3)

ax.set_xlabel('Packet Size (bytes)', color='#1f2937', fontsize=10)
ax.set_ylabel('Duration (s)', color='#1f2937', fontsize=10)
ax.set_zlabel('Port Entropy', color='#1f2937', fontsize=10)
ax.set_title('Network Intrusion Detection System', color='#1f2937', fontsize=14, fontweight='bold', pad=20)

ax.tick_params(colors='#6b7280', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#e5e7eb')
ax.yaxis.pane.set_edgecolor('#e5e7eb')
ax.zaxis.pane.set_edgecolor('#e5e7eb')

ax.view_init(elev=20, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support