Skip to content

Commit 16eb277

Browse files
update(heatmap-basic): seaborn — comprehensive quality review
Comprehensive quality review: fix weaknesses from prior reviews, preserve strengths, improve quality across all dimensions.
1 parent 89f6f3b commit 16eb277

4 files changed

Lines changed: 31 additions & 26 deletions

File tree

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" pyplots.ai
1+
"""pyplots.ai
22
heatmap-basic: Basic Heatmap
3-
Library: seaborn 0.13.2 | Python 3.13.11
4-
Quality: 93/100 | Created: 2025-12-23
3+
Library: seaborn 0.13.2 | Python 3.14.3
4+
Quality: /100 | Updated: 2026-02-15
55
"""
66

77
import matplotlib.pyplot as plt
@@ -24,35 +24,39 @@
2424
# Clip to valid performance range
2525
data = np.clip(data, 5, 95)
2626

27-
# Plot - using square format for heatmap
28-
fig, ax = plt.subplots(figsize=(12, 12))
29-
sns.heatmap(
27+
# Plot - clustermap groups similar departments via hierarchical clustering
28+
cmap = sns.diverging_palette(240, 10, as_cmap=True)
29+
g = sns.clustermap(
3030
data,
3131
annot=True,
3232
fmt=".0f",
33-
cmap="RdBu",
33+
cmap=cmap,
3434
center=50,
3535
xticklabels=months,
3636
yticklabels=departments,
3737
linewidths=1,
3838
linecolor="white",
39-
cbar_kws={"label": "Performance Score", "shrink": 0.75},
40-
annot_kws={"fontsize": 16},
41-
ax=ax,
39+
annot_kws={"fontsize": 14},
40+
figsize=(16, 10),
41+
row_cluster=True,
42+
col_cluster=False,
43+
dendrogram_ratio=0.08,
44+
cbar_pos=None,
4245
vmin=0,
4346
vmax=100,
4447
)
4548

46-
# Style
47-
ax.set_xlabel("Month", fontsize=20)
48-
ax.set_ylabel("Department", fontsize=20)
49-
ax.set_title("heatmap-basic · seaborn · pyplots.ai", fontsize=24, pad=20)
50-
ax.tick_params(axis="both", labelsize=16)
51-
52-
# Adjust colorbar label size
53-
cbar = ax.collections[0].colorbar
49+
# Colorbar with proper placement
50+
sm = plt.cm.ScalarMappable(cmap=cmap, norm=plt.Normalize(0, 100))
51+
cbar = g.fig.colorbar(sm, ax=g.ax_heatmap, location="right", shrink=0.7, pad=0.12)
52+
cbar.set_label("Performance Score", fontsize=18)
5453
cbar.ax.tick_params(labelsize=14)
55-
cbar.ax.set_ylabel("Performance Score", fontsize=18)
5654

57-
plt.tight_layout()
55+
# Style
56+
g.ax_heatmap.set_xlabel("Month", fontsize=20)
57+
g.ax_heatmap.set_ylabel("")
58+
g.ax_heatmap.tick_params(axis="x", labelsize=16)
59+
g.ax_heatmap.tick_params(axis="y", labelsize=16, rotation=0)
60+
g.fig.suptitle("heatmap-basic · seaborn · pyplots.ai", fontsize=24, y=1.02)
61+
5862
plt.savefig("plot.png", dpi=300, bbox_inches="tight")

plots/heatmap-basic/metadata/seaborn.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
library: seaborn
22
specification_id: heatmap-basic
33
created: '2025-12-23T00:46:00Z'
4-
updated: '2025-12-23T00:49:07Z'
5-
generated_by: claude-opus-4-5-20251101
4+
updated: '2026-02-15T21:25:00+00:00'
5+
generated_by: claude-opus-4-6
66
workflow_run: 20447949053
77
issue: 0
8-
python_version: 3.13.11
8+
python_version: 3.14.3
99
library_version: 0.13.2
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/seaborn/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/seaborn/plot_thumb.png
1212
preview_html: null
13-
quality_score: 93
13+
quality_score: null
1414
impl_tags:
1515
dependencies: []
1616
techniques:

plots/heatmap-basic/specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ A heatmap displaying values in a matrix format using color intensity. Each cell'
2323
- Use a diverging colormap for data with positive/negative values
2424
- Add value annotations in cells when readable
2525
- Include a colorbar legend
26-
- Consider clustering rows/columns for better pattern visibility
26+
- Order rows/columns logically (alphabetical, by magnitude, or by similarity)

plots/heatmap-basic/specification.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Basic Heatmap
66

77
# Specification tracking
88
created: 2025-12-14T09:02:34Z
9-
updated: 2025-12-14T09:02:34Z
9+
updated: 2026-02-15T12:00:00Z
1010
issue: 691
1111
suggested: MarkusNeusinger
1212

@@ -18,6 +18,7 @@ tags:
1818
data_type:
1919
- numeric
2020
- categorical
21+
- matrix
2122
domain:
2223
- statistics
2324
- general

0 commit comments

Comments
 (0)