3D Scatter

Urban Heat Island Analysis

City temperature mapping showing urban heat island effect by land use type.

Output
Urban Heat Island Analysis
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(888)

# Urban temperature monitoring
n_points = 160

# City grid
x = np.random.uniform(0, 20, n_points)  # km
y = np.random.uniform(0, 15, n_points)  # km

# Temperature (higher in center, near roads)
dist_center = np.sqrt((x - 10)**2 + (y - 7.5)**2)
temperature = 32 - dist_center * 0.3 + np.random.normal(0, 1.5, n_points)

# Land use
land_use = np.random.choice(['Urban', 'Park', 'Industrial', 'Residential'], n_points, p=[0.3, 0.15, 0.2, 0.35])
use_colors = {
    'Urban': '#F5276C',
    'Park': '#6CF527',
    'Industrial': '#F5B027',
    'Residential': '#27D3F5'
}
colors = [use_colors[u] for u in land_use]

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

ax.scatter(x, y, temperature, c=colors, s=60, alpha=0.7, edgecolors='#374151', linewidths=0.3)

ax.set_xlabel('X (km)', color='#1f2937', fontsize=10)
ax.set_ylabel('Y (km)', color='#1f2937', fontsize=10)
ax.set_zlabel('Temperature (°C)', color='#1f2937', fontsize=10)
ax.set_title('Urban Heat Island Analysis', 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=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support