Skip to content

Commit 199ca6b

Browse files
feat(plotnine): implement line-filled (#2652)
## Implementation: `line-filled` - plotnine Implements the **plotnine** version of `line-filled`. **File:** `plots/line-filled/implementations/plotnine.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20595335022)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 760bb71 commit 199ca6b

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
""" pyplots.ai
2+
line-filled: Filled Line Plot
3+
Library: plotnine 0.15.2 | Python 3.13.11
4+
Quality: 91/100 | Created: 2025-12-30
5+
"""
6+
7+
import numpy as np
8+
import pandas as pd
9+
from plotnine import aes, element_line, element_text, geom_area, geom_line, ggplot, labs, theme, theme_minimal
10+
11+
12+
# Data - Monthly website traffic over a year
13+
np.random.seed(42)
14+
months = np.arange(1, 13)
15+
base_traffic = 50000 + np.cumsum(np.random.randn(12) * 5000)
16+
seasonal = 10000 * np.sin(np.pi * months / 6)
17+
visitors = base_traffic + seasonal + np.random.randn(12) * 3000
18+
visitors = np.maximum(visitors, 20000)
19+
20+
df = pd.DataFrame({"Month": months, "Visitors": visitors})
21+
22+
# Plot
23+
plot = (
24+
ggplot(df, aes(x="Month", y="Visitors"))
25+
+ geom_area(fill="#306998", alpha=0.4)
26+
+ geom_line(color="#306998", size=2)
27+
+ labs(x="Month", y="Website Visitors", title="line-filled · plotnine · pyplots.ai")
28+
+ theme_minimal()
29+
+ theme(
30+
figure_size=(16, 9),
31+
text=element_text(size=14),
32+
axis_title=element_text(size=20),
33+
axis_text=element_text(size=16),
34+
plot_title=element_text(size=24),
35+
panel_grid_major=element_line(color="#cccccc", size=0.5, alpha=0.3),
36+
panel_grid_minor=element_line(alpha=0),
37+
)
38+
)
39+
40+
# Save
41+
plot.save("plot.png", dpi=300, verbose=False)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
library: plotnine
2+
specification_id: line-filled
3+
created: '2025-12-30T11:21:44Z'
4+
updated: '2025-12-30T11:24:22Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20595335022
7+
issue: 0
8+
python_version: 3.13.11
9+
library_version: 0.15.2
10+
preview_url: https://storage.googleapis.com/pyplots-images/plots/line-filled/plotnine/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-filled/plotnine/plot_thumb.png
12+
preview_html: null
13+
quality_score: 91
14+
review:
15+
strengths:
16+
- Excellent layering of geom_area and geom_line to create the filled effect with
17+
visible line on top
18+
- Well-chosen alpha value (0.4) matches spec recommendation (0.3-0.5)
19+
- Clean, professional appearance with consistent Python blue color (#306998)
20+
- Good use of theme customization for text sizing and grid styling
21+
- Realistic website traffic scenario with appropriate seasonal variation
22+
weaknesses:
23+
- X-axis displays months as decimals (2.5, 5.0, 7.5) instead of integers (1, 2,
24+
3...12) which is confusing for monthly data
25+
- Y-axis label could include units (e.g., Website Visitors (thousands) or use K
26+
formatting)

0 commit comments

Comments
 (0)