3D Scatter

Urban Air Quality Sensor Network

Urban air quality monitoring network showing PM2.5 concentrations at various heights.

Output
Urban Air Quality Sensor Network
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(333)

# Urban air quality monitoring
n_sensors = 100

# City grid with some vertical spread (buildings)
x = np.random.uniform(0, 10, n_sensors)  # km
y = np.random.uniform(0, 8, n_sensors)   # km
z = np.random.exponential(15, n_sensors) + 2  # meters above ground

# PM2.5 values (higher near ground, varies by location)
pm25 = 50 - z * 0.5 + np.random.exponential(20, n_sensors)
pm25 = np.clip(pm25, 5, 150)

# Size by uncertainty
uncertainty = np.random.uniform(20, 80, n_sensors)

fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')

# Color: green=good, yellow=moderate, red=unhealthy
scatter = ax.scatter(x, y, z, c=pm25, cmap='RdYlGn_r', s=uncertainty, 
                     alpha=0.7, edgecolors='#374151', linewidths=0.5)

cbar = plt.colorbar(scatter, ax=ax, shrink=0.6, pad=0.1)
cbar.set_label('PM2.5 (μg/m³)', color='#1f2937', fontsize=10)
cbar.ax.tick_params(colors='#6b7280')

ax.set_xlabel('X (km)', color='#1f2937', fontsize=10)
ax.set_ylabel('Y (km)', color='#1f2937', fontsize=10)
ax.set_zlabel('Height (m)', color='#1f2937', fontsize=10)
ax.set_title('Urban Air Quality Sensor Network', color='#1f2937', fontsize=14, fontweight='bold', pad=20)

ax.tick_params(colors='#6b7280', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#e5e7eb')
ax.yaxis.pane.set_edgecolor('#e5e7eb')
ax.zaxis.pane.set_edgecolor('#e5e7eb')

ax.view_init(elev=25, azim=35)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support