Skip to content

Commit b663f83

Browse files
update(violin-basic): seaborn — comprehensive quality review
Comprehensive quality review improving code quality, data choice, visual design, spec compliance, and library feature usage.
1 parent e9894a3 commit b663f83

2 files changed

Lines changed: 34 additions & 31 deletions

File tree

plots/violin-basic/implementations/seaborn.py

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" pyplots.ai
22
violin-basic: Basic Violin Plot
3-
Library: seaborn 0.13.2 | Python 3.13.11
4-
Quality: 92/100 | Created: 2025-12-23
3+
Library: seaborn 0.13.2 | Python 3.14.3
4+
Quality: /100 | Updated: 2026-02-21
55
"""
66

77
import matplotlib.pyplot as plt
@@ -12,25 +12,23 @@
1212

1313
# Data - Salary distributions across departments
1414
np.random.seed(42)
15-
categories = ["Engineering", "Marketing", "Sales", "Support"]
16-
data = []
17-
18-
for cat in categories:
19-
# Different distribution shapes per category
20-
if cat == "Engineering":
21-
values = np.random.normal(85000, 15000, 150)
22-
elif cat == "Marketing":
23-
values = np.random.normal(70000, 12000, 150)
24-
elif cat == "Sales":
25-
# Bimodal distribution for sales (junior vs senior)
26-
values = np.concatenate([np.random.normal(55000, 8000, 75), np.random.normal(90000, 10000, 75)])
27-
else: # Support
28-
values = np.random.normal(55000, 10000, 150)
29-
30-
for v in values:
31-
data.append({"Department": cat, "Salary": v})
32-
33-
df = pd.DataFrame(data)
15+
departments = ["Engineering", "Marketing", "Sales", "Support"]
16+
records = []
17+
18+
for dept in departments:
19+
if dept == "Engineering":
20+
salaries = np.random.normal(85000, 15000, 150)
21+
elif dept == "Marketing":
22+
salaries = np.random.normal(70000, 12000, 150)
23+
elif dept == "Sales":
24+
# Bimodal distribution (junior vs senior) — showcases KDE strength
25+
salaries = np.concatenate([np.random.normal(55000, 8000, 75), np.random.normal(90000, 10000, 75)])
26+
else:
27+
salaries = np.random.normal(55000, 10000, 150)
28+
for s in salaries:
29+
records.append({"Department": dept, "Salary": s})
30+
31+
df = pd.DataFrame(records)
3432

3533
# Plot
3634
fig, ax = plt.subplots(figsize=(16, 9))
@@ -40,19 +38,24 @@
4038
x="Department",
4139
y="Salary",
4240
hue="Department",
43-
palette=["#306998", "#FFD43B", "#306998", "#FFD43B"],
44-
inner="quart", # Show quartiles inside violin
45-
linewidth=2,
41+
palette=["#306998", "#4A90C4", "#2D5F8A", "#5BA3D9"],
42+
inner="box",
43+
cut=0,
44+
linewidth=1.5,
45+
saturation=0.9,
4646
legend=False,
4747
ax=ax,
4848
)
4949

5050
# Style
5151
ax.set_xlabel("Department", fontsize=20)
5252
ax.set_ylabel("Salary ($)", fontsize=20)
53-
ax.set_title("violin-basic · seaborn · pyplots.ai", fontsize=24)
53+
ax.set_title("violin-basic \u00b7 seaborn \u00b7 pyplots.ai", fontsize=24, fontweight="medium")
5454
ax.tick_params(axis="both", labelsize=16)
55-
ax.grid(True, alpha=0.3, linestyle="--", axis="y")
55+
ax.spines["top"].set_visible(False)
56+
ax.spines["right"].set_visible(False)
57+
ax.yaxis.grid(True, alpha=0.2, linewidth=0.8)
58+
ax.set_axisbelow(True)
5659

5760
# Format y-axis as currency
5861
ax.yaxis.set_major_formatter(plt.FuncFormatter(lambda x, p: f"${x / 1000:.0f}k"))

plots/violin-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: violin-basic
33
created: '2025-12-23T00:36:01Z'
4-
updated: '2025-12-23T00:39:02Z'
5-
generated_by: claude-opus-4-5-20251101
4+
updated: '2026-02-21T22:25:00+00:00'
5+
generated_by: claude-opus-4-6
66
workflow_run: 20447774216
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/violin-basic/seaborn/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/violin-basic/seaborn/plot_thumb.png
1212
preview_html: null
13-
quality_score: 92
13+
quality_score: null
1414
impl_tags:
1515
dependencies: []
1616
techniques: []

0 commit comments

Comments
 (0)