Skip to content

Commit dcadcd5

Browse files
update(bump-basic): seaborn — comprehensive quality review
Refactored data construction, custom color palette, improved theming and font sizes.
1 parent 1e072e3 commit dcadcd5

4 files changed

Lines changed: 76 additions & 58 deletions

File tree

Lines changed: 67 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" pyplots.ai
1+
"""pyplots.ai
22
bump-basic: Basic Bump Chart
3-
Library: seaborn 0.13.2 | Python 3.13.11
4-
Quality: 91/100 | Created: 2025-12-23
3+
Library: seaborn 0.13.2 | Python 3.14.3
4+
Quality: /100 | Updated: 2026-02-22
55
"""
66

77
import matplotlib.pyplot as plt
@@ -10,67 +10,82 @@
1010

1111

1212
# Data - Sports league standings over 6 weeks
13-
data = {
14-
"Team": ["Lions"] * 6 + ["Tigers"] * 6 + ["Bears"] * 6 + ["Eagles"] * 6 + ["Wolves"] * 6,
15-
"Week": ["Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6"] * 5,
16-
"Rank": [
17-
3,
18-
2,
19-
1,
20-
1,
21-
2,
22-
1, # Lions - start mid, climb to top
23-
1,
24-
1,
25-
2,
26-
3,
27-
1,
28-
2, # Tigers - start top, fluctuate
29-
5,
30-
4,
31-
4,
32-
2,
33-
3,
34-
3, # Bears - steady climb from bottom
35-
2,
36-
3,
37-
3,
38-
4,
39-
4,
40-
5, # Eagles - gradual decline
41-
4,
42-
5,
43-
5,
44-
5,
45-
5,
46-
4, # Wolves - mostly bottom, slight recovery
47-
],
48-
}
49-
df = pd.DataFrame(data)
13+
teams = ["Lions", "Tigers", "Bears", "Eagles", "Wolves"]
14+
weeks = ["Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6"]
15+
ranks = [
16+
3,
17+
2,
18+
1,
19+
1,
20+
2,
21+
1, # Lions - start mid, climb to top
22+
1,
23+
1,
24+
2,
25+
3,
26+
1,
27+
2, # Tigers - start top, fluctuate
28+
5,
29+
4,
30+
4,
31+
2,
32+
3,
33+
3, # Bears - steady climb from bottom
34+
2,
35+
3,
36+
3,
37+
4,
38+
4,
39+
5, # Eagles - gradual decline
40+
4,
41+
5,
42+
5,
43+
5,
44+
5,
45+
4, # Wolves - mostly bottom, slight recovery
46+
]
47+
df = pd.DataFrame(
48+
{"Team": [team for team in teams for _ in weeks], "Competition Week": weeks * len(teams), "League Position": ranks}
49+
)
5050

51-
# Colors for each team - Python Blue first, then distinct colorblind-safe colors
51+
# Palette - Python Blue first, then distinct colorblind-safe colors
5252
palette = ["#306998", "#FFD43B", "#E74C3C", "#2ECC71", "#9B59B6"]
5353

54-
# Create plot
54+
# Plot
55+
sns.set_theme(
56+
style="whitegrid",
57+
rc={"axes.spines.top": False, "axes.spines.right": False, "grid.linestyle": "--", "grid.alpha": 0.2},
58+
)
5559
fig, ax = plt.subplots(figsize=(16, 9))
5660

57-
sns.lineplot(data=df, x="Week", y="Rank", hue="Team", marker="o", markersize=18, linewidth=4, palette=palette, ax=ax)
61+
sns.lineplot(
62+
data=df,
63+
x="Competition Week",
64+
y="League Position",
65+
hue="Team",
66+
style="Team",
67+
markers=True,
68+
dashes=False,
69+
markersize=18,
70+
linewidth=4,
71+
palette=palette,
72+
sort=False,
73+
ax=ax,
74+
)
5875

5976
# Invert y-axis so rank 1 is at top
6077
ax.invert_yaxis()
61-
62-
# Set y-axis ticks to integer ranks only
6378
ax.set_yticks([1, 2, 3, 4, 5])
79+
ax.xaxis.grid(False)
6480

65-
# Styling
66-
ax.set_xlabel("Week", fontsize=20)
67-
ax.set_ylabel("Rank", fontsize=20)
68-
ax.set_title("bump-basic · seaborn · pyplots.ai", fontsize=24)
81+
# Style
82+
ax.set_xlabel("Competition Week", fontsize=20)
83+
ax.set_ylabel("League Position", fontsize=20)
84+
ax.set_title("bump-basic · seaborn · pyplots.ai", fontsize=24, fontweight="medium")
6985
ax.tick_params(axis="both", labelsize=16)
70-
ax.grid(True, alpha=0.3, linestyle="--")
7186

72-
# Legend styling - placed outside plot area
73-
ax.legend(title="Team", fontsize=14, title_fontsize=16, loc="center left", bbox_to_anchor=(1, 0.5))
87+
# Legend
88+
ax.legend(title="Team", fontsize=14, title_fontsize=16, loc="center left", bbox_to_anchor=(1, 0.5), frameon=False)
7489

7590
plt.tight_layout()
7691
plt.savefig("plot.png", dpi=300, bbox_inches="tight")

plots/bump-basic/metadata/seaborn.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
library: seaborn
22
specification_id: bump-basic
33
created: '2025-12-23T09:18:13Z'
4-
updated: '2025-12-23T09:20:51Z'
5-
generated_by: claude-opus-4-5-20251101
4+
updated: '2026-02-22T20:55:00+00:00'
5+
generated_by: claude-opus-4-6
66
workflow_run: 20456606720
77
issue: 0
8-
python_version: 3.13.11
9-
library_version: 0.13.2
8+
python_version: '3.14.3'
9+
library_version: '0.13.2'
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/bump-basic/seaborn/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/bump-basic/seaborn/plot_thumb.png
1212
preview_html: null
13-
quality_score: 91
13+
quality_score: null
1414
impl_tags:
1515
dependencies: []
1616
techniques:

plots/bump-basic/specification.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ A bump chart visualizes how rankings change over time by plotting rank positions
1717
- `period` (categorical or time) - Time points for ranking snapshots
1818
- `rank` (integer) - Position at each period (1 = highest rank)
1919
- Size: 5-10 entities, 4-8 periods typical
20+
- Example: Formula 1 driver standings over a 10-race season
2021

2122
## Notes
2223

plots/bump-basic/specification.yaml

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

77
# Specification tracking
88
created: 2025-12-15T20:42:43Z
9-
updated: 2025-12-15T20:42:43Z
9+
updated: 2026-02-22T12:00:00Z
1010
issue: 982
1111
suggested: MarkusNeusinger
1212

@@ -18,9 +18,11 @@ tags:
1818
data_type:
1919
- categorical
2020
- ordinal
21+
- timeseries
2122
domain:
2223
- general
2324
features:
2425
- basic
2526
- ranking
2627
- temporal
28+
- comparison

0 commit comments

Comments
 (0)