Skip to content

Commit 4cb4566

Browse files
feat(seaborn): implement point-basic (#2566)
## Implementation: `point-basic` - seaborn Implements the **seaborn** version of `point-basic`. **File:** `plots/point-basic/implementations/seaborn.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20593348794)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 0ec587d commit 4cb4566

2 files changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
""" pyplots.ai
2+
point-basic: Point Estimate Plot
3+
Library: seaborn 0.13.2 | Python 3.13.11
4+
Quality: 92/100 | Created: 2025-12-30
5+
"""
6+
7+
import matplotlib.pyplot as plt
8+
import numpy as np
9+
import pandas as pd
10+
import seaborn as sns
11+
12+
13+
# Data: Product satisfaction ratings with confidence intervals
14+
np.random.seed(42)
15+
categories = ["Product A", "Product B", "Product C", "Product D", "Product E", "Product F"]
16+
estimates = [7.2, 6.5, 8.1, 5.9, 7.8, 6.2]
17+
# Varying confidence interval widths to show different uncertainty levels
18+
ci_widths = [0.8, 1.2, 0.5, 1.5, 0.7, 1.1]
19+
lower = [e - w for e, w in zip(estimates, ci_widths, strict=True)]
20+
upper = [e + w for e, w in zip(estimates, ci_widths, strict=True)]
21+
22+
df = pd.DataFrame({"Product": categories, "Satisfaction": estimates, "Lower": lower, "Upper": upper})
23+
24+
# Create plot (4800x2700 px at 300 dpi = 16x9 inches)
25+
fig, ax = plt.subplots(figsize=(16, 9))
26+
27+
# Plot points using seaborn pointplot
28+
# Using horizontal orientation for better label readability
29+
sns.pointplot(
30+
data=df,
31+
x="Satisfaction",
32+
y="Product",
33+
orient="h",
34+
color="#306998",
35+
markers="o",
36+
markersize=15,
37+
linestyle="none", # Remove connecting lines between points
38+
err_kws={"linewidth": 0}, # We'll draw custom error bars for more control
39+
ax=ax,
40+
)
41+
42+
# Draw error bars with caps manually for better control
43+
for i, (_, row) in enumerate(df.iterrows()):
44+
ax.errorbar(
45+
x=row["Satisfaction"],
46+
y=i,
47+
xerr=[[row["Satisfaction"] - row["Lower"]], [row["Upper"] - row["Satisfaction"]]],
48+
fmt="none",
49+
color="#306998",
50+
capsize=8,
51+
capthick=3,
52+
elinewidth=3,
53+
)
54+
55+
# Add reference line at overall mean
56+
overall_mean = np.mean(estimates)
57+
ax.axvline(
58+
x=overall_mean,
59+
color="#FFD43B",
60+
linestyle="--",
61+
linewidth=2.5,
62+
alpha=0.8,
63+
label=f"Overall Mean ({overall_mean:.1f})",
64+
)
65+
66+
# Labels and styling (scaled for 4800x2700)
67+
ax.set_xlabel("Satisfaction Score (1-10)", fontsize=20)
68+
ax.set_ylabel("Product", fontsize=20)
69+
ax.set_title("point-basic · seaborn · pyplots.ai", fontsize=24)
70+
ax.tick_params(axis="both", labelsize=16)
71+
ax.grid(True, alpha=0.3, linestyle="--", axis="x")
72+
73+
# Legend
74+
ax.legend(fontsize=16, loc="lower right")
75+
76+
# Set x-axis limits to show context
77+
ax.set_xlim(3, 10)
78+
79+
plt.tight_layout()
80+
plt.savefig("plot.png", dpi=300, bbox_inches="tight")
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
library: seaborn
2+
specification_id: point-basic
3+
created: '2025-12-30T09:31:12Z'
4+
updated: '2025-12-30T09:40:23Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20593348794
7+
issue: 0
8+
python_version: 3.13.11
9+
library_version: 0.13.2
10+
preview_url: https://storage.googleapis.com/pyplots-images/plots/point-basic/seaborn/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/point-basic/seaborn/plot_thumb.png
12+
preview_html: null
13+
quality_score: 92
14+
review:
15+
strengths:
16+
- Excellent horizontal orientation for category label readability as recommended
17+
in spec
18+
- Clear visual hierarchy with well-sized points and error bars with caps
19+
- Helpful reference line showing overall mean with legend explanation
20+
- Good use of varying confidence interval widths to demonstrate uncertainty differences
21+
- Proper title format and axis labeling with units
22+
weaknesses:
23+
- Error bars drawn manually with matplotlib errorbar instead of using seaborn native
24+
confidence interval features
25+
- All confidence intervals are symmetric around estimates; real-world CIs are often
26+
asymmetric

0 commit comments

Comments
 (0)