Skip to content

Commit 8205995

Browse files
feat(letsplot): implement point-basic (#2589)
## Implementation: `point-basic` - letsplot Implements the **letsplot** version of `point-basic`. **File:** `plots/point-basic/implementations/letsplot.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20593353470)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent a1cfdf9 commit 8205995

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
""" pyplots.ai
2+
point-basic: Point Estimate Plot
3+
Library: letsplot 4.8.2 | Python 3.13.11
4+
Quality: 92/100 | Created: 2025-12-30
5+
"""
6+
7+
import numpy as np
8+
import pandas as pd
9+
from lets_plot import *
10+
11+
12+
LetsPlot.setup_html()
13+
14+
# Data - Research study results with confidence intervals
15+
np.random.seed(42)
16+
categories = ["Treatment A", "Treatment B", "Treatment C", "Control", "Placebo"]
17+
estimates = [4.2, 5.8, 3.1, 2.5, 1.8]
18+
# Generate realistic confidence intervals (narrower for larger effects)
19+
ci_width = [0.9, 1.1, 0.7, 0.8, 0.6]
20+
lower = [e - w for e, w in zip(estimates, ci_width)]
21+
upper = [e + w for e, w in zip(estimates, ci_width)]
22+
23+
df = pd.DataFrame({"group": categories, "estimate": estimates, "lower": lower, "upper": upper})
24+
25+
# Plot - Horizontal point estimate plot with confidence intervals
26+
plot = (
27+
ggplot(df, aes(x="group", y="estimate", ymin="lower", ymax="upper"))
28+
+ geom_pointrange(color="#306998", size=1.5, linewidth=1.5)
29+
+ geom_hline(yintercept=0, linetype="dashed", color="#666666", size=0.8, alpha=0.7)
30+
+ labs(y="Effect Size (95% CI)", x="Treatment Group", title="point-basic · lets-plot · pyplots.ai")
31+
+ coord_flip()
32+
+ theme_minimal()
33+
+ theme(
34+
plot_title=element_text(size=24, face="bold"),
35+
axis_title=element_text(size=20),
36+
axis_text=element_text(size=16),
37+
panel_grid_major_x=element_blank(),
38+
panel_grid_minor=element_blank(),
39+
)
40+
+ ggsize(1600, 900)
41+
)
42+
43+
# Save
44+
ggsave(plot, "plot.png", path=".", scale=3)
45+
46+
# Save interactive HTML
47+
ggsave(plot, "plot.html", path=".")
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
library: letsplot
2+
specification_id: point-basic
3+
created: '2025-12-30T09:34:53Z'
4+
updated: '2025-12-30T09:44:43Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20593353470
7+
issue: 0
8+
python_version: 3.13.11
9+
library_version: 4.8.2
10+
preview_url: https://storage.googleapis.com/pyplots-images/plots/point-basic/letsplot/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/point-basic/letsplot/plot_thumb.png
12+
preview_html: https://storage.googleapis.com/pyplots-images/plots/point-basic/letsplot/plot.html
13+
quality_score: 92
14+
review:
15+
strengths:
16+
- Excellent use of geom_pointrange for clean point-and-interval visualization
17+
- Proper horizontal orientation with coord_flip for readable category labels
18+
- Reference line at zero helps interpretation of effect sizes
19+
- Clean minimal theme with appropriate font sizes for the 4800x2700 output
20+
- Realistic clinical trial scenario with varying confidence interval widths
21+
weaknesses:
22+
- All effect sizes are positive; including at least one negative or zero-crossing
23+
effect would better demonstrate the plot utility
24+
- Does not include error bar caps at endpoints (spec suggests caps)

0 commit comments

Comments
 (0)