Skip to content

Commit 3bb3696

Browse files
github-actions[bot]claudeMarkusNeusinger
authored
feat(letsplot): implement learning-curve-basic (#6219)
## Implementation: `learning-curve-basic` - python/letsplot Implements the **python/letsplot** version of `learning-curve-basic`. **File:** `plots/learning-curve-basic/implementations/python/letsplot.py` **Parent Issue:** #2275 --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/anyplot/actions/runs/25618840563)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com> Co-authored-by: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com>
1 parent 8239b62 commit 3bb3696

2 files changed

Lines changed: 168 additions & 144 deletions

File tree

plots/learning-curve-basic/implementations/python/letsplot.py

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
""" pyplots.ai
1+
""" anyplot.ai
22
learning-curve-basic: Model Learning Curve
3-
Library: letsplot 4.8.2 | Python 3.13.11
4-
Quality: 92/100 | Created: 2025-12-26
3+
Library: letsplot 4.9.0 | Python 3.13.13
4+
Quality: 90/100 | Updated: 2026-05-10
55
"""
66

7+
import os
8+
79
import numpy as np
810
import pandas as pd
911
from lets_plot import * # noqa: F403
@@ -12,6 +14,16 @@
1214

1315
LetsPlot.setup_html() # noqa: F405
1416

17+
# Theme tokens
18+
THEME = os.getenv("ANYPLOT_THEME", "light")
19+
PAGE_BG = "#FAF8F1" if THEME == "light" else "#1A1A17"
20+
ELEVATED_BG = "#FFFDF6" if THEME == "light" else "#242420"
21+
INK = "#1A1A17" if THEME == "light" else "#F0EFE8"
22+
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"
23+
24+
# Okabe-Ito palette (first series always #009E73)
25+
OKABE_ITO = ["#009E73", "#D55E00", "#0072B2", "#CC79A7", "#E69F00", "#56B4E9", "#F0E442"]
26+
1527
# Data - Simulate learning curve for a model showing slight overfitting pattern
1628
np.random.seed(42)
1729

@@ -72,30 +84,35 @@
7284
+ geom_ribbon(aes(ymin="Lower", ymax="Upper"), alpha=0.2, color="rgba(0,0,0,0)")
7385
+ geom_line(size=2)
7486
+ geom_point(size=4)
75-
+ scale_color_manual(values=["#306998", "#FFD43B"])
76-
+ scale_fill_manual(values=["#306998", "#FFD43B"])
87+
+ scale_color_manual(values=OKABE_ITO[:2])
88+
+ scale_fill_manual(values=OKABE_ITO[:2])
7789
+ scale_y_continuous(limits=[0.55, 1.02])
7890
+ scale_x_continuous(limits=[0, 1700], breaks=list(range(0, 1800, 200)))
7991
+ labs(
8092
x="Training Set Size (samples)",
81-
y="Accuracy Score",
82-
title="learning-curve-basic · letsplot · pyplots.ai",
93+
y="Accuracy Score (0-1)",
94+
title="learning-curve-basic · letsplot · anyplot.ai",
8395
color="",
8496
fill="",
8597
)
8698
+ theme_minimal()
8799
+ theme(
88-
plot_title=element_text(size=24),
89-
axis_title=element_text(size=20),
90-
axis_text=element_text(size=16),
91-
legend_text=element_text(size=16),
92-
legend_position="bottom",
93-
panel_grid_major=element_line(color="#CCCCCC", size=0.5),
100+
plot_background=element_rect(fill=PAGE_BG, color=PAGE_BG),
101+
panel_background=element_rect(fill=PAGE_BG),
102+
panel_grid_major=element_line(color=INK_SOFT, size=0.3),
94103
panel_grid_minor=element_blank(),
104+
axis_title=element_text(color=INK, size=20),
105+
axis_text=element_text(color=INK_SOFT, size=16),
106+
axis_line=element_line(color=INK_SOFT),
107+
plot_title=element_text(color=INK, size=24),
108+
legend_background=element_rect(fill=ELEVATED_BG, color=INK_SOFT),
109+
legend_text=element_text(color=INK_SOFT, size=16),
110+
legend_title=element_text(color=INK),
111+
legend_position="bottom",
95112
)
96113
+ ggsize(1600, 900)
97114
)
98115

99116
# Save as PNG (scale 3x = 4800 x 2700 px) and HTML
100-
ggsave(plot, "plot.png", path=".", scale=3)
101-
ggsave(plot, "plot.html", path=".")
117+
ggsave(plot, f"plot-{THEME}.png", path=".", scale=3)
118+
ggsave(plot, f"plot-{THEME}.html", path=".")

0 commit comments

Comments
 (0)