Skip to content

Commit 24538e3

Browse files
feat(letsplot): implement line-filled (#2675)
## Implementation: `line-filled` - letsplot Implements the **letsplot** version of `line-filled`. **File:** `plots/line-filled/implementations/letsplot.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20595337286)* --------- 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 ab38b13 commit 24538e3

2 files changed

Lines changed: 70 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+
line-filled: Filled Line 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 - Monthly website traffic over a year
15+
np.random.seed(42)
16+
months = np.arange(1, 13)
17+
base_traffic = 50000 + np.cumsum(np.random.randn(12) * 5000)
18+
seasonal_effect = 10000 * np.sin(np.pi * months / 6)
19+
traffic = base_traffic + seasonal_effect + np.random.randn(12) * 3000
20+
traffic = np.maximum(traffic, 20000) # Ensure positive values
21+
22+
df = pd.DataFrame({"month": months, "visitors": traffic})
23+
24+
# Create filled line plot
25+
plot = (
26+
ggplot(df, aes(x="month", y="visitors"))
27+
+ geom_area(fill="#306998", alpha=0.4)
28+
+ geom_line(color="#306998", size=2)
29+
+ geom_point(color="#306998", size=5)
30+
+ labs(x="Month", y="Website Visitors", title="line-filled · letsplot · pyplots.ai")
31+
+ scale_x_continuous(breaks=list(range(1, 13)))
32+
+ ggsize(1600, 900)
33+
+ theme_minimal()
34+
+ theme(
35+
plot_title=element_text(size=24),
36+
axis_title=element_text(size=20),
37+
axis_text=element_text(size=16),
38+
panel_grid_major=element_line(color="#CCCCCC", size=0.5),
39+
panel_grid_minor=element_blank(),
40+
)
41+
)
42+
43+
# Save PNG (scale 3x for 4800 × 2700 px)
44+
ggsave(plot, "plot.png", path=".", scale=3)
45+
46+
# Save HTML for interactivity
47+
ggsave(plot, "plot.html", path=".")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
library: letsplot
2+
specification_id: line-filled
3+
created: '2025-12-30T11:23:34Z'
4+
updated: '2025-12-30T11:35:57Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20595337286
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-filled/letsplot/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-filled/letsplot/plot_thumb.png
12+
preview_html: https://storage.googleapis.com/pyplots-images/plots/line-filled/letsplot/plot.html
13+
quality_score: 92
14+
review:
15+
strengths:
16+
- Excellent use of geom_area + geom_line + geom_point combination for a complete
17+
filled line visualization
18+
- Perfect title format and well-chosen realistic data context (website traffic)
19+
- Clean code structure following KISS principles with proper reproducibility seed
20+
- Good visual balance with appropriate fill transparency (0.4) and line visibility
21+
weaknesses:
22+
- Axis labels lack units (e.g., "Month (2024)" or "Visitors (thousands)")
23+
- Data variation could be more pronounced to better showcase the filled area effect

0 commit comments

Comments
 (0)