Skip to content

Commit 0d10989

Browse files
feat(matplotlib): implement line-styled (#2613)
## Implementation: `line-styled` - matplotlib Implements the **matplotlib** version of `line-styled`. **File:** `plots/line-styled/implementations/matplotlib.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20594555861)* --------- 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 56d4b2b commit 0d10989

2 files changed

Lines changed: 74 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-styled: Styled Line Plot
3+
Library: matplotlib 3.10.8 | Python 3.13.11
4+
Quality: 93/100 | Created: 2025-12-30
5+
"""
6+
7+
import matplotlib.pyplot as plt
8+
import numpy as np
9+
10+
11+
# Data - CPU performance benchmarks over time
12+
np.random.seed(42)
13+
months = np.arange(1, 13)
14+
month_labels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
15+
16+
# Simulated performance scores for different processors
17+
base_score = 100
18+
processor_a = base_score + np.cumsum(np.random.randn(12) * 3 + 2) # Steady improvement
19+
processor_b = base_score + np.cumsum(np.random.randn(12) * 4 + 1.5) # Variable improvement
20+
processor_c = base_score + np.cumsum(np.random.randn(12) * 2 + 2.5) # Faster improvement
21+
processor_d = base_score + np.cumsum(np.random.randn(12) * 3 + 0.5) # Slower improvement
22+
23+
# Plot
24+
fig, ax = plt.subplots(figsize=(16, 9))
25+
26+
# Plot lines with different styles
27+
ax.plot(months, processor_a, linestyle="-", linewidth=3, color="#306998", label="Processor A", marker="o", markersize=8)
28+
ax.plot(
29+
months, processor_b, linestyle="--", linewidth=3, color="#FFD43B", label="Processor B", marker="s", markersize=8
30+
)
31+
ax.plot(months, processor_c, linestyle=":", linewidth=3, color="#4B8BBE", label="Processor C", marker="^", markersize=8)
32+
ax.plot(
33+
months, processor_d, linestyle="-.", linewidth=3, color="#646464", label="Processor D", marker="D", markersize=8
34+
)
35+
36+
# Labels and styling
37+
ax.set_xlabel("Month", fontsize=20)
38+
ax.set_ylabel("Performance Score", fontsize=20)
39+
ax.set_title("line-styled · matplotlib · pyplots.ai", fontsize=24)
40+
ax.set_xticks(months)
41+
ax.set_xticklabels(month_labels)
42+
ax.tick_params(axis="both", labelsize=16)
43+
ax.grid(True, alpha=0.3, linestyle="--")
44+
ax.legend(fontsize=16, loc="upper left")
45+
46+
plt.tight_layout()
47+
plt.savefig("plot.png", dpi=300, bbox_inches="tight")
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
library: matplotlib
2+
specification_id: line-styled
3+
created: '2025-12-30T10:37:53Z'
4+
updated: '2025-12-30T10:45:03Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20594555861
7+
issue: 0
8+
python_version: 3.13.11
9+
library_version: 3.10.8
10+
preview_url: https://storage.googleapis.com/pyplots-images/plots/line-styled/matplotlib/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-styled/matplotlib/plot_thumb.png
12+
preview_html: null
13+
quality_score: 93
14+
review:
15+
strengths:
16+
- All four standard line styles (solid, dashed, dotted, dash-dot) are clearly visible
17+
and easily distinguishable
18+
- Added markers provide additional visual differentiation beyond line styles alone
19+
- Consistent line width across all series maintains visual harmony
20+
- Legend clearly maps styles to series names as required by the specification
21+
- The plot is well-suited for black-and-white printing - the different line styles
22+
would remain distinguishable without color
23+
weaknesses:
24+
- Axis labels could include units (e.g., Performance Score (pts) or Relative Performance)
25+
- 'Blue color palette has two similar shades (#306998 and #4B8BBE) - while line
26+
styles make them distinguishable, more contrasting colors would improve color
27+
accessibility further'

0 commit comments

Comments
 (0)