Skip to content

Commit 5c2d990

Browse files
feat(pygal): implement line-markers (#2619)
## Implementation: `line-markers` - pygal Implements the **pygal** version of `line-markers`. **File:** `plots/line-markers/implementations/pygal.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20594559283)* --------- 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 450d725 commit 5c2d990

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
""" pyplots.ai
2+
line-markers: Line Plot with Markers
3+
Library: pygal 3.1.0 | Python 3.13.11
4+
Quality: 91/100 | Created: 2025-12-30
5+
"""
6+
7+
import numpy as np
8+
import pygal
9+
from pygal.style import Style
10+
11+
12+
# Data - Temperature readings over time (sparse experimental data)
13+
np.random.seed(42)
14+
x_values = np.arange(0, 12) # 12 months
15+
sensor_a = 20 + 5 * np.sin(x_values * np.pi / 6) + np.random.randn(12) * 1.5
16+
sensor_b = 18 + 4 * np.sin(x_values * np.pi / 6 + 1) + np.random.randn(12) * 1.2
17+
sensor_c = 22 + 3 * np.sin(x_values * np.pi / 6 + 2) + np.random.randn(12) * 1.0
18+
19+
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
20+
21+
# Custom style for large canvas
22+
custom_style = Style(
23+
background="white",
24+
plot_background="white",
25+
foreground="#333333",
26+
foreground_strong="#333333",
27+
foreground_subtle="#666666",
28+
colors=("#306998", "#FFD43B", "#E74C3C"), # Python Blue, Python Yellow, Red
29+
title_font_size=72,
30+
label_font_size=48,
31+
major_label_font_size=42,
32+
legend_font_size=42,
33+
value_font_size=36,
34+
stroke_width=6,
35+
opacity=0.9,
36+
opacity_hover=1.0,
37+
transition="400ms ease-in",
38+
font_family="sans-serif",
39+
)
40+
41+
# Create line chart with markers
42+
chart = pygal.Line(
43+
width=4800,
44+
height=2700,
45+
style=custom_style,
46+
title="line-markers · pygal · pyplots.ai",
47+
x_title="Month",
48+
y_title="Temperature (°C)",
49+
show_dots=True,
50+
dots_size=16,
51+
stroke_style={"width": 6},
52+
show_x_guides=False,
53+
show_y_guides=True,
54+
legend_at_bottom=False,
55+
legend_box_size=32,
56+
margin=100,
57+
spacing=50,
58+
explicit_size=True,
59+
truncate_legend=-1,
60+
x_label_rotation=0,
61+
show_x_labels=True,
62+
)
63+
64+
# Set x-axis labels
65+
chart.x_labels = months
66+
67+
# Add data series
68+
chart.add("Sensor A", sensor_a.tolist())
69+
chart.add("Sensor B", sensor_b.tolist())
70+
chart.add("Sensor C", sensor_c.tolist())
71+
72+
# Save as PNG and HTML
73+
chart.render_to_png("plot.png")
74+
chart.render_to_file("plot.html")
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
library: pygal
2+
specification_id: line-markers
3+
created: '2025-12-30T10:38:14Z'
4+
updated: '2025-12-30T10:45:46Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20594559283
7+
issue: 0
8+
python_version: 3.13.11
9+
library_version: 3.1.0
10+
preview_url: https://storage.googleapis.com/pyplots-images/plots/line-markers/pygal/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-markers/pygal/plot_thumb.png
12+
preview_html: https://storage.googleapis.com/pyplots-images/plots/line-markers/pygal/plot.html
13+
quality_score: 91
14+
review:
15+
strengths:
16+
- Excellent text legibility with well-scaled font sizes for the large canvas
17+
- Clear colorblind-safe color palette (blue, yellow, red)
18+
- Proper use of pygal marker functionality with show_dots=True and dots_size=16
19+
- Realistic temperature sensor scenario with appropriate seasonal variation
20+
- Correct title format following pyplots.ai conventions
21+
- Good use of custom Style for consistent, professional appearance
22+
weaknesses:
23+
- Legend placement in upper left creates slight visual imbalance; positioning at
24+
bottom would be better
25+
- Grid lines only on Y-axis; could add subtle X-guides for complete reference
26+
- Marker visibility good but does not use different marker shapes for series as
27+
suggested in spec notes (pygal limitation)

0 commit comments

Comments
 (0)