Skip to content

Commit 8ca0c75

Browse files
Merge branch 'main' into implementation/stem-basic/seaborn
2 parents c7d507a + c766545 commit 8ca0c75

2 files changed

Lines changed: 186 additions & 131 deletions

File tree

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
1-
""" pyplots.ai
1+
""" anyplot.ai
22
stem-basic: Basic Stem Plot
3-
Library: matplotlib 3.10.8 | Python 3.13.11
4-
Quality: 94/100 | Created: 2025-12-23
3+
Library: matplotlib 3.10.9 | Python 3.13.13
4+
Quality: 91/100 | Updated: 2026-04-30
55
"""
66

7+
import os
8+
79
import matplotlib.pyplot as plt
810
import numpy as np
911

1012

11-
# Data - Discrete signal samples (simulating a damped oscillation)
13+
# Theme tokens
14+
THEME = os.getenv("ANYPLOT_THEME", "light")
15+
PAGE_BG = "#FAF8F1" if THEME == "light" else "#1A1A17"
16+
INK = "#1A1A17" if THEME == "light" else "#F0EFE8"
17+
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"
18+
BRAND = "#009E73"
19+
20+
# Data - discrete damped oscillation signal
1221
np.random.seed(42)
1322
x = np.arange(0, 30)
1423
y = np.exp(-x / 10) * np.cos(x * 0.8) + np.random.randn(30) * 0.05
1524

16-
# Create plot (4800x2700 px)
17-
fig, ax = plt.subplots(figsize=(16, 9))
25+
# Plot
26+
fig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)
27+
ax.set_facecolor(PAGE_BG)
1828

19-
# Stem plot with custom styling
20-
markerline, stemlines, baseline = ax.stem(x, y, basefmt="k-")
21-
plt.setp(stemlines, linewidth=2, color="#306998", alpha=0.8)
22-
plt.setp(markerline, markersize=12, color="#306998", markeredgecolor="white", markeredgewidth=2)
23-
plt.setp(baseline, linewidth=2, color="#333333")
29+
markerline, stemlines, baseline = ax.stem(x, y, basefmt="-")
30+
plt.setp(stemlines, linewidth=2, color=BRAND, alpha=0.8)
31+
plt.setp(markerline, markersize=12, color=BRAND, markeredgecolor=PAGE_BG, markeredgewidth=2)
32+
plt.setp(baseline, linewidth=1.5, color=INK_SOFT)
2433

25-
# Labels and styling (scaled font sizes for 4800x2700)
26-
ax.set_xlabel("Sample Index", fontsize=20)
27-
ax.set_ylabel("Amplitude", fontsize=20)
28-
ax.set_title("stem-basic · matplotlib · pyplots.ai", fontsize=24)
29-
ax.tick_params(axis="both", labelsize=16)
30-
ax.grid(True, alpha=0.3, linestyle="--")
34+
# Style
35+
ax.set_xlabel("Sample Index (n)", fontsize=20, color=INK)
36+
ax.set_ylabel("Amplitude (V)", fontsize=20, color=INK)
37+
ax.set_title("stem-basic · matplotlib · anyplot.ai", fontsize=24, fontweight="medium", color=INK)
38+
ax.tick_params(axis="both", labelsize=16, colors=INK_SOFT)
39+
ax.spines["top"].set_visible(False)
40+
ax.spines["right"].set_visible(False)
41+
for s in ("left", "bottom"):
42+
ax.spines[s].set_color(INK_SOFT)
43+
ax.yaxis.grid(True, alpha=0.12, linewidth=0.8, color=INK)
3144

45+
# Save
3246
plt.tight_layout()
33-
plt.savefig("plot.png", dpi=300, bbox_inches="tight")
47+
plt.savefig(f"plot-{THEME}.png", dpi=300, bbox_inches="tight", facecolor=PAGE_BG)

0 commit comments

Comments
 (0)