Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions plots/line-markers/implementations/matplotlib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
""" pyplots.ai
line-markers: Line Plot with Markers
Library: matplotlib 3.10.8 | Python 3.13.11
Quality: 94/100 | Created: 2025-12-30
"""

import matplotlib.pyplot as plt
import numpy as np


# Data - Temperature readings over 14 days from weather stations
np.random.seed(42)
days = np.arange(1, 15)

# Station A: Coastal location (moderate, stable)
station_a = 18 + np.cumsum(np.random.randn(14) * 0.8)

# Station B: Inland location (more variable)
station_b = 15 + np.cumsum(np.random.randn(14) * 1.2)

# Station C: Mountain location (cooler, different pattern)
station_c = 10 + np.cumsum(np.random.randn(14) * 1.0)

# Create plot
fig, ax = plt.subplots(figsize=(16, 9))

# Plot lines with different marker styles
ax.plot(
days,
station_a,
marker="o",
markersize=12,
linewidth=3,
color="#306998",
label="Coastal Station",
markeredgecolor="white",
markeredgewidth=2,
)

ax.plot(
days,
station_b,
marker="s",
markersize=12,
linewidth=3,
color="#FFD43B",
label="Inland Station",
markeredgecolor="white",
markeredgewidth=2,
)

ax.plot(
days,
station_c,
marker="^",
markersize=12,
linewidth=3,
color="#E74C3C",
label="Mountain Station",
markeredgecolor="white",
markeredgewidth=2,
)

# Labels and styling
ax.set_xlabel("Day", fontsize=20)
ax.set_ylabel("Temperature (°C)", fontsize=20)
ax.set_title("line-markers · matplotlib · pyplots.ai", fontsize=24)
ax.tick_params(axis="both", labelsize=16)
ax.grid(True, alpha=0.3, linestyle="--")
ax.legend(fontsize=16, loc="best")

# Set x-axis to show all days
ax.set_xticks(days)

plt.tight_layout()
plt.savefig("plot.png", dpi=300, bbox_inches="tight")
28 changes: 28 additions & 0 deletions plots/line-markers/metadata/matplotlib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
library: matplotlib
specification_id: line-markers
created: '2025-12-30T10:38:02Z'
updated: '2025-12-30T10:45:06Z'
generated_by: claude-opus-4-5-20251101
workflow_run: 20594555710
issue: 0
python_version: 3.13.11
library_version: 3.10.8
preview_url: https://storage.googleapis.com/pyplots-images/plots/line-markers/matplotlib/plot.png
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-markers/matplotlib/plot_thumb.png
preview_html: null
quality_score: 94
review:
strengths:
- Excellent marker visibility with white edge borders creating strong contrast against
lines
- Three distinct marker shapes (circle, square, triangle) for easy series differentiation
- Realistic weather station scenario with plausible temperature ranges
- Clean, readable code following KISS principles
- Perfect title format and axis labels with units
weaknesses:
- Could demonstrate filled vs unfilled markers as suggested in spec notes for additional
distinction
- Legend placement inside plot area could potentially overlap with data in edge
cases
- Does not leverage more distinctive matplotlib features like annotations or custom
styling