Heatmap

Sensor Temperature Grid

Seamless heatmap of temperature readings from industrial sensors

Output
Sensor Temperature Grid
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

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

np.random.seed(42)
data = np.random.uniform(20, 45, (12, 12))
data[4:8, 4:8] += 15
data[2:4, 8:10] += 10

# Modern gradient: Cool Blue to Hot Pink (thermal style)
colors = ['#cffafe', '#22d3ee', '#fbbf24', '#f97316', '#dc2626']
cmap = LinearSegmentedColormap.from_list('modern', colors, N=256)

im = ax.imshow(data, cmap=cmap, aspect='equal', vmin=20, vmax=65)

for i in range(12):
    for j in range(12):
        val = data[i, j]
        color = '#ffffff' if val > 45 else '#1f2937'
        ax.text(j, i, f'{val:.0f}', ha='center', va='center', color=color, fontsize=9, fontweight='500')

ax.set_xticks(range(12))
ax.set_yticks(range(12))
ax.set_xticklabels([f'C{i+1}' for i in range(12)], color='#374151', fontsize=9)
ax.set_yticklabels([f'R{i+1}' for i in range(12)], color='#1f2937', fontsize=9)

cbar = plt.colorbar(im, ax=ax, shrink=0.8, pad=0.02)
cbar.set_label('Temperature (°C)', color='#1f2937', fontsize=11)
cbar.outline.set_edgecolor('#e5e7eb')
plt.setp(plt.getp(cbar.ax.axes, 'yticklabels'), color='#6b7280')

for spine in ax.spines.values():
    spine.set_color('#e5e7eb')
ax.set_title('Industrial Sensor Temperature Grid', fontsize=16, color='#111827', fontweight='bold', pad=15)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Heatmaps & Density

Did this help you?

Support PyLucid to keep it free & growing

Support