Skip to content

Commit 58579ea

Browse files
feat(pygal): implement polar-line (#2698)
## Implementation: `polar-line` - pygal Implements the **pygal** version of `polar-line`. **File:** `plots/polar-line/implementations/pygal.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20596061354)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 5b287b2 commit 58579ea

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
""" pyplots.ai
2+
polar-line: Polar Line Plot
3+
Library: pygal 3.1.0 | Python 3.13.11
4+
Quality: 91/100 | Created: 2025-12-30
5+
"""
6+
7+
import pygal
8+
from pygal.style import Style
9+
10+
11+
# Custom style for large canvas (4800x2700)
12+
custom_style = Style(
13+
background="white",
14+
plot_background="white",
15+
foreground="#333",
16+
foreground_strong="#333",
17+
foreground_subtle="#666",
18+
colors=("#306998", "#FFD43B"),
19+
title_font_size=72,
20+
label_font_size=48,
21+
major_label_font_size=42,
22+
legend_font_size=48,
23+
value_font_size=36,
24+
stroke_width=6,
25+
opacity=0.9,
26+
opacity_hover=1.0,
27+
)
28+
29+
# Data - Monthly temperature variations (cyclical pattern)
30+
# 12 months at 30-degree intervals
31+
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
32+
33+
# Average high temperatures - Northern hemisphere pattern
34+
avg_high = [5.2, 7.1, 12.3, 16.8, 21.5, 25.2, 28.1, 27.4, 23.2, 17.1, 10.8, 6.3]
35+
36+
# Average low temperatures
37+
avg_low = [-2.1, -0.8, 3.2, 7.5, 12.1, 16.3, 19.2, 18.5, 14.1, 8.3, 3.1, -0.5]
38+
39+
# Create polar/radar chart (pygal uses Radar for polar-style plots)
40+
chart = pygal.Radar(
41+
width=4800,
42+
height=2700,
43+
style=custom_style,
44+
title="polar-line · pygal · pyplots.ai",
45+
show_legend=True,
46+
legend_at_bottom=True,
47+
legend_box_size=32,
48+
dots_size=12,
49+
fill=False,
50+
show_dots=True,
51+
range=(-5, 35),
52+
truncate_legend=-1,
53+
margin=60,
54+
)
55+
56+
# X-axis labels (months around the circle)
57+
chart.x_labels = months
58+
59+
# Add temperature series
60+
chart.add("Avg High Temp", avg_high)
61+
chart.add("Avg Low Temp", avg_low)
62+
63+
# Render to PNG and HTML
64+
chart.render_to_png("plot.png")
65+
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: polar-line
3+
created: '2025-12-30T12:05:05Z'
4+
updated: '2025-12-30T12:08:58Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20596061354
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/polar-line/pygal/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/polar-line/pygal/plot_thumb.png
12+
preview_html: https://storage.googleapis.com/pyplots-images/plots/polar-line/pygal/plot.html
13+
quality_score: 91
14+
review:
15+
strengths:
16+
- Excellent choice of seasonal temperature data that perfectly demonstrates cyclical
17+
patterns
18+
- Clean, professional visual appearance with well-balanced layout
19+
- Appropriate use of pygal Radar chart as the closest equivalent to polar-line
20+
- Good color contrast between series (blue/yellow) that is colorblind-accessible
21+
- Proper title formatting following pyplots.ai conventions
22+
- Font sizes appropriately scaled for the 4800x2700 canvas
23+
weaknesses:
24+
- Radial axis labels lack units (should show °C somewhere)
25+
- Could benefit from more distinct styling or pygal-specific features like custom
26+
tooltips
27+
- Month labels could be slightly larger for better readability at full scale

0 commit comments

Comments
 (0)