Skip to content

Commit 99a3c9b

Browse files
feat(letsplot): implement line-markers (#2630)
## Implementation: `line-markers` - letsplot Implements the **letsplot** version of `line-markers`. **File:** `plots/line-markers/implementations/letsplot.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20594559908)* --------- 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 a8f7ba6 commit 99a3c9b

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
""" pyplots.ai
2+
line-markers: Line Plot with Markers
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 - Quarterly product performance metrics
15+
np.random.seed(42)
16+
quarters = np.arange(1, 13) # 12 quarters (3 years)
17+
18+
# Three product lines with different growth patterns
19+
product_a = 45 + np.cumsum(np.random.randn(12) * 3) + np.arange(12) * 2
20+
product_b = 60 + np.cumsum(np.random.randn(12) * 4) + np.arange(12) * 1.5
21+
product_c = 35 + np.cumsum(np.random.randn(12) * 2.5) + np.arange(12) * 2.5
22+
23+
df = pd.DataFrame(
24+
{
25+
"Quarter": list(quarters) * 3,
26+
"Revenue": np.concatenate([product_a, product_b, product_c]),
27+
"Product": ["Product A"] * 12 + ["Product B"] * 12 + ["Product C"] * 12,
28+
}
29+
)
30+
31+
# Create plot
32+
plot = (
33+
ggplot(df, aes(x="Quarter", y="Revenue", color="Product"))
34+
+ geom_line(size=2.5)
35+
+ geom_point(size=6, alpha=0.9)
36+
+ scale_color_manual(values=["#306998", "#FFD43B", "#DC2626"])
37+
+ scale_x_continuous(breaks=list(range(1, 13)))
38+
+ labs(x="Quarter", y="Revenue (Million USD)", title="line-markers · lets-plot · pyplots.ai")
39+
+ theme_minimal()
40+
+ theme(
41+
plot_title=element_text(size=28),
42+
axis_title=element_text(size=22),
43+
axis_text=element_text(size=18),
44+
legend_title=element_text(size=20),
45+
legend_text=element_text(size=18),
46+
legend_position="right",
47+
panel_grid_major=element_line(color="#CCCCCC", size=0.5),
48+
)
49+
+ ggsize(1600, 900)
50+
)
51+
52+
# Save outputs
53+
ggsave(plot, "plot.png", path=".", scale=3)
54+
ggsave(plot, "plot.html", path=".")
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
library: letsplot
2+
specification_id: line-markers
3+
created: '2025-12-30T10:39:36Z'
4+
updated: '2025-12-30T10:50:10Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20594559908
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/line-markers/letsplot/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-markers/letsplot/plot_thumb.png
12+
preview_html: https://storage.googleapis.com/pyplots-images/plots/line-markers/letsplot/plot.html
13+
quality_score: 92
14+
review:
15+
strengths:
16+
- Excellent text sizing for readability at target resolution (28pt title, 22pt axes,
17+
18pt ticks)
18+
- Clean ggplot2-style grammar with proper layering of geom_line and geom_point
19+
- Realistic business scenario with quarterly product performance showing distinct
20+
trends
21+
- Good color contrast between the three product lines
22+
- Markers are clearly visible against the lines with appropriate alpha (0.9)
23+
weaknesses:
24+
- Grid alpha 0.5 is too prominent - should be 0.2-0.4 for subtlety
25+
- Could use different marker shapes for multiple series as suggested in the spec
26+
notes

0 commit comments

Comments
 (0)