3D Stem

Network Traffic Analysis

Network monitoring showing packet arrivals with timing, source, and size information.

Output
Network Traffic Analysis
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(888)

# Network packet arrival times
n_packets = 35
arrival_time = np.cumsum(np.random.exponential(0.01, n_packets))
packet_size = np.random.choice([64, 128, 512, 1500], n_packets)
source_ip = np.random.randint(0, 5, n_packets)

x = arrival_time / arrival_time.max()
y = source_ip / 5
z = packet_size / 1500

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

markerline, stemlines, baseline = ax.stem(x, y, z, linefmt='-', markerfmt='o', basefmt=' ')
plt.setp(stemlines, color='#6366f1', linewidth=1.5, alpha=0.7)
plt.setp(markerline, color='#818cf8', markersize=7)

ax.set_xlabel('Time', color='#1f2937', fontsize=10)
ax.set_ylabel('Source IP', color='#1f2937', fontsize=10)
ax.set_zlabel('Packet Size', color='#1f2937', fontsize=10)
ax.set_title('Network Traffic Analysis', 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