Error Bar Chart

Cryptocurrency Daily Volatility

Crypto daily returns with volatility bands showing risk profiles for major cryptocurrencies.

Output
Cryptocurrency Daily Volatility
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)

cryptos = ['Bitcoin', 'Ethereum', 'Solana', 'Cardano', 'Polygon']
daily_return = np.array([2.8, 3.5, 5.2, 4.1, 4.8])
volatility = np.array([4.2, 5.8, 12.5, 8.2, 9.5])

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

x = np.arange(len(cryptos))
colors = ['#F5B027', '#5314E6', '#27D3F5', '#276CF5', '#F5276C']

for i, (ret, vol, c) in enumerate(zip(daily_return, volatility, colors)):
    ax.errorbar(i, ret, yerr=vol, fmt='o', color=c, ecolor=c,
                elinewidth=3, capsize=8, capthick=2.5, markersize=16,
                markeredgecolor='#1f2937', markeredgewidth=2, alpha=0.9)
    ax.annotate(f{vol}%', xy=(i, ret + vol + 0.8), ha='center',
                color='#6b7280', fontsize=9, fontweight='500')

ax.axhline(y=0, color='#d1d5db', linestyle='-', linewidth=1)
ax.set_xlabel('Cryptocurrency', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('Daily Return (%)', fontsize=12, color='#374151', fontweight='600')
ax.set_title('Crypto Daily Returns with Volatility Range', fontsize=15, 
             color='#1f2937', fontweight='bold', pad=20)

ax.set_xticks(x)
ax.set_xticklabels(cryptos, fontsize=11, fontweight='500')
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(-12, 20)
ax.grid(True, axis='y', alpha=0.4, color='#e5e7eb', linestyle='-')
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