Heatmap
Crypto Portfolio Heatmap
Clean heatmap showing cryptocurrency performance across exchanges
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
np.random.seed(42)
cryptos = ['BTC', 'ETH', 'SOL', 'ADA', 'DOT', 'AVAX', 'MATIC', 'LINK']
exchanges = ['Binance', 'Coinbase', 'Kraken', 'FTX', 'KuCoin', 'Gemini']
data = np.random.uniform(-15, 25, (len(cryptos), len(exchanges)))
data[0, :3] = [18, 22, 15]
data[1, 2:5] = [28, 24, 20]
# Subtle: Light gray → Cyan
colors = ['#f8fafc', '#e0f2fe', '#7dd3fc', '#27D3F5']
cmap = LinearSegmentedColormap.from_list('SubtleCyan', colors, N=256)
fig, ax = plt.subplots(figsize=(12, 9), facecolor='#ffffff')
im = ax.imshow(data, cmap=cmap, aspect='auto', vmin=-20, vmax=30)
ax.set_xticks(range(len(exchanges)))
ax.set_yticks(range(len(cryptos)))
ax.set_xticklabels(exchanges, fontsize=11, color='#374151')
ax.set_yticklabels(cryptos, fontsize=11, color='#1f2937', fontweight='500')
for i in range(len(cryptos)):
for j in range(len(exchanges)):
val = data[i, j]
color = '#1f2937'
ax.text(j, i, f'{val:.1f}%', ha='center', va='center', fontsize=10, fontweight='500', color=color)
cbar = plt.colorbar(im, ax=ax, shrink=0.6, pad=0.02)
cbar.set_label('24h Change %', fontsize=11, color='#1f2937')
cbar.ax.tick_params(labelsize=9, colors='#6b7280')
cbar.outline.set_visible(False)
for spine in ax.spines.values():
spine.set_visible(False)
ax.tick_params(length=0)
ax.set_title('Crypto Performance by Exchange', fontsize=16, color='#1f2937', fontweight='bold', pad=15)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Heatmaps & Density
More Heatmap examples
☕