Skip to content

Commit c0a82cf

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

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
""" pyplots.ai
2+
line-markers: Line Plot with Markers
3+
Library: matplotlib 3.10.8 | Python 3.13.11
4+
Quality: 94/100 | Created: 2025-12-30
5+
"""
6+
7+
import matplotlib.pyplot as plt
8+
import numpy as np
9+
10+
11+
# Data - Temperature readings over 14 days from weather stations
12+
np.random.seed(42)
13+
days = np.arange(1, 15)
14+
15+
# Station A: Coastal location (moderate, stable)
16+
station_a = 18 + np.cumsum(np.random.randn(14) * 0.8)
17+
18+
# Station B: Inland location (more variable)
19+
station_b = 15 + np.cumsum(np.random.randn(14) * 1.2)
20+
21+
# Station C: Mountain location (cooler, different pattern)
22+
station_c = 10 + np.cumsum(np.random.randn(14) * 1.0)
23+
24+
# Create plot
25+
fig, ax = plt.subplots(figsize=(16, 9))
26+
27+
# Plot lines with different marker styles
28+
ax.plot(
29+
days,
30+
station_a,
31+
marker="o",
32+
markersize=12,
33+
linewidth=3,
34+
color="#306998",
35+
label="Coastal Station",
36+
markeredgecolor="white",
37+
markeredgewidth=2,
38+
)
39+
40+
ax.plot(
41+
days,
42+
station_b,
43+
marker="s",
44+
markersize=12,
45+
linewidth=3,
46+
color="#FFD43B",
47+
label="Inland Station",
48+
markeredgecolor="white",
49+
markeredgewidth=2,
50+
)
51+
52+
ax.plot(
53+
days,
54+
station_c,
55+
marker="^",
56+
markersize=12,
57+
linewidth=3,
58+
color="#E74C3C",
59+
label="Mountain Station",
60+
markeredgecolor="white",
61+
markeredgewidth=2,
62+
)
63+
64+
# Labels and styling
65+
ax.set_xlabel("Day", fontsize=20)
66+
ax.set_ylabel("Temperature (°C)", fontsize=20)
67+
ax.set_title("line-markers · matplotlib · pyplots.ai", fontsize=24)
68+
ax.tick_params(axis="both", labelsize=16)
69+
ax.grid(True, alpha=0.3, linestyle="--")
70+
ax.legend(fontsize=16, loc="best")
71+
72+
# Set x-axis to show all days
73+
ax.set_xticks(days)
74+
75+
plt.tight_layout()
76+
plt.savefig("plot.png", dpi=300, bbox_inches="tight")
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
library: matplotlib
2+
specification_id: line-markers
3+
created: '2025-12-30T10:38:02Z'
4+
updated: '2025-12-30T10:45:06Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20594555710
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-markers/matplotlib/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-markers/matplotlib/plot_thumb.png
12+
preview_html: null
13+
quality_score: 94
14+
review:
15+
strengths:
16+
- Excellent marker visibility with white edge borders creating strong contrast against
17+
lines
18+
- Three distinct marker shapes (circle, square, triangle) for easy series differentiation
19+
- Realistic weather station scenario with plausible temperature ranges
20+
- Clean, readable code following KISS principles
21+
- Perfect title format and axis labels with units
22+
weaknesses:
23+
- Could demonstrate filled vs unfilled markers as suggested in spec notes for additional
24+
distinction
25+
- Legend placement inside plot area could potentially overlap with data in edge
26+
cases
27+
- Does not leverage more distinctive matplotlib features like annotations or custom
28+
styling

0 commit comments

Comments
 (0)