Error Bar Chart
VPN Performance Impact
VPN service speed retention and latency comparison.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
vpns = ['NordVPN', 'ExpressVPN', 'Surfshark', 'ProtonVPN', 'Private\nInternet']
speed_retention = np.array([88, 92, 85, 78, 82])
latency_add = np.array([12, 8, 15, 22, 18])
speed_err = np.array([4, 3, 5, 6, 5])
latency_err = np.array([3, 2, 4, 5, 4])
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5), facecolor='#ffffff')
for ax in [ax1, ax2]:
ax.set_facecolor('#ffffff')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#d1d5db')
ax.spines['bottom'].set_color('#d1d5db')
x = np.arange(len(vpns))
colors = ['#F5276C', '#F5B027', '#27D3F5', '#6CF527', '#5314E6']
# Speed retention
ax1.bar(x, speed_retention, yerr=speed_err, capsize=5, color=colors,
edgecolor='white', linewidth=1.5,
error_kw={'ecolor': '#374151', 'elinewidth': 2})
ax1.axhline(y=85, color='#6CF527', linestyle='--', linewidth=2, alpha=0.7)
ax1.set_xlabel('VPN Provider', fontsize=11, color='#374151', fontweight='600')
ax1.set_ylabel('Speed Retention (%)', fontsize=11, color='#374151', fontweight='600')
ax1.set_title('Download Speed', fontsize=13, color='#1f2937', fontweight='bold')
ax1.set_xticks(x)
ax1.set_xticklabels(vpns, fontsize=9, rotation=15, ha='right')
ax1.set_ylim(65, 100)
ax1.tick_params(colors='#6b7280', labelsize=9)
ax1.grid(True, axis='y', alpha=0.4, color='#e5e7eb')
# Latency added
ax2.bar(x, latency_add, yerr=latency_err, capsize=5, color=colors,
edgecolor='white', linewidth=1.5,
error_kw={'ecolor': '#374151', 'elinewidth': 2})
ax2.axhline(y=15, color='#F5276C', linestyle='--', linewidth=2, alpha=0.7)
ax2.set_xlabel('VPN Provider', fontsize=11, color='#374151', fontweight='600')
ax2.set_ylabel('Added Latency (ms)', fontsize=11, color='#374151', fontweight='600')
ax2.set_title('Connection Latency', fontsize=13, color='#1f2937', fontweight='bold')
ax2.set_xticks(x)
ax2.set_xticklabels(vpns, fontsize=9, rotation=15, ha='right')
ax2.set_ylim(0, 35)
ax2.tick_params(colors='#6b7280', labelsize=9)
ax2.grid(True, axis='y', alpha=0.4, color='#e5e7eb')
plt.suptitle('VPN Performance Impact', fontsize=15, color='#1f2937',
fontweight='bold', y=1.02)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More Error Bar Chart examples
☕