Bubble Chart
Climate Change Data Bubble
Decades analyzed by temperature anomaly, CO2 levels, and sea level.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
fig, ax = plt.subplots(figsize=(14, 9), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
decades = ['1960s', '1970s', '1980s', '1990s', '2000s', '2010s', '2020s']
temp_anomaly = np.array([-0.02, 0.02, 0.18, 0.32, 0.52, 0.75, 1.02])
co2 = np.array([320, 330, 345, 360, 380, 400, 420])
sea_level = np.array([10, 25, 45, 70, 100, 140, 190])
colors = ['#27D3F5', '#276CF5', '#4927F5', '#6CF527', '#F5B027', '#F54927', '#C82909']
sizes = sea_level * 5
for glow_mult, glow_alpha in [(2.0, 0.03), (1.6, 0.05), (1.3, 0.08)]:
ax.scatter(co2, temp_anomaly, s=sizes*glow_mult, c='#000000', alpha=glow_alpha, edgecolors='none')
ax.scatter(co2, temp_anomaly, s=sizes, c=colors, alpha=0.85, edgecolors='white', linewidth=2)
ax.scatter(co2 - np.sqrt(sizes)*0.3, temp_anomaly + np.sqrt(sizes)*0.005, s=sizes*0.2, c='white', alpha=0.6, edgecolors='none')
for i, decade in enumerate(decades):
offset_y = np.sqrt(sizes[i])/2 + 10
ax.annotate(decade, (co2[i], temp_anomaly[i]), fontsize=12, color='#1f2937',
ha='center', va='bottom', xytext=(0, offset_y), textcoords='offset points', fontweight='bold')
ax.text(0.0, 1.08, 'Climate Change Trends', transform=ax.transAxes, fontsize=24, color='#1f2937', fontweight='bold')
ax.text(0.0, 1.02, 'CO2 vs Temperature Anomaly · Bubble size = Sea Level Rise', transform=ax.transAxes, fontsize=11, color='#6b7280')
ax.set_xlabel('CO2 Concentration (ppm)', fontsize=14, color='#4b5563', fontweight='500', labelpad=15)
ax.set_ylabel('Temperature Anomaly (°C)', fontsize=14, color='#4b5563', fontweight='500', labelpad=15)
ax.tick_params(colors='#6b7280', labelsize=11, length=0)
for y in [-0.5, 0, 0.5, 1.0, 1.5]:
ax.axhline(y=y, color='#f3f4f6', linewidth=1, zorder=0)
for spine in ax.spines.values():
spine.set_visible(False)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Bubble Chart examples
☕