Error Bar Chart

Cloud Provider Global Latency

Cloud service provider latency comparison across global regions.

Output
Cloud Provider Global Latency
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)

regions = ['US East', 'US West', 'EU West', 'Asia Pacific', 'South America']
aws = np.array([12, 15, 18, 45, 85])
azure = np.array([14, 18, 22, 52, 92])
gcp = np.array([11, 14, 20, 48, 88])
aws_err = np.array([2, 3, 3, 8, 12])
azure_err = np.array([3, 4, 4, 10, 15])
gcp_err = np.array([2, 2, 4, 9, 14])

fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

x = np.arange(len(regions))
width = 0.25

ax.bar(x - width, aws, width, yerr=aws_err, label='AWS',
       color='#F5B027', edgecolor='white', linewidth=1.5, capsize=4,
       error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x, azure, width, yerr=azure_err, label='Azure',
       color='#27D3F5', edgecolor='white', linewidth=1.5, capsize=4,
       error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x + width, gcp, width, yerr=gcp_err, label='Google Cloud',
       color='#F5276C', edgecolor='white', linewidth=1.5, capsize=4,
       error_kw={'ecolor': '#374151', 'elinewidth': 1.5})

ax.axhline(y=50, color='#6CF527', linestyle='--', linewidth=2, alpha=0.7)

ax.set_xlabel('Region', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('Latency (ms)', fontsize=12, color='#374151', fontweight='600')
ax.set_title('Cloud Provider Global Latency', fontsize=15, 
             color='#1f2937', fontweight='bold', pad=20)

ax.set_xticks(x)
ax.set_xticklabels(regions, fontsize=10, rotation=15, ha='right')
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', fontsize=10)
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(0, 120)
ax.grid(True, axis='y', alpha=0.4, color='#e5e7eb')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#d1d5db')
ax.spines['bottom'].set_color('#d1d5db')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support