{"spec_id":"polar-line","library":"pygal","language":"python","code":"\"\"\" anyplot.ai\npolar-line: Polar Line Plot\nLibrary: pygal 3.1.0 | Python 3.13.13\nQuality: 90/100 | Updated: 2026-05-12\n\"\"\"\n\nimport os\n\nimport numpy as np\nimport pygal\nfrom pygal.style import Style\n\n\n# Theme-adaptive colors\nTHEME = os.getenv(\"ANYPLOT_THEME\", \"light\")\nPAGE_BG = \"#FAF8F1\" if THEME == \"light\" else \"#1A1A17\"\nINK = \"#1A1A17\" if THEME == \"light\" else \"#F0EFE8\"\nINK_SOFT = \"#4A4A44\" if THEME == \"light\" else \"#B8B7B0\"\nINK_MUTED = \"#6B6A63\" if THEME == \"light\" else \"#A8A79F\"\n\n# Okabe-Ito palette (first series is always #009E73)\nIMPRINT = (\"#009E73\", \"#C475FD\", \"#4467A3\", \"#BD8233\", \"#AE3030\", \"#2ABCCD\", \"#954477\")\n\n# Data - Hourly wind speed variation (cyclical data)\nnp.random.seed(42)\nhours = [f\"{h:02d}:00\" for h in range(24)]\n\n# Day 1 - Typical breezy day pattern\nday_1 = [\n    3.2,\n    2.8,\n    2.5,\n    2.1,\n    2.0,\n    2.3,\n    3.1,\n    4.5,\n    6.2,\n    7.8,\n    8.9,\n    9.5,\n    10.2,\n    10.8,\n    10.5,\n    9.8,\n    8.6,\n    7.2,\n    5.8,\n    4.2,\n    3.8,\n    3.5,\n    3.3,\n    3.2,\n]\n\n# Day 2 - Calmer day pattern\nday_2 = [\n    2.1,\n    1.9,\n    1.8,\n    1.7,\n    1.6,\n    1.8,\n    2.4,\n    3.2,\n    4.1,\n    4.8,\n    5.2,\n    5.6,\n    5.8,\n    5.9,\n    5.7,\n    5.2,\n    4.6,\n    3.8,\n    3.1,\n    2.5,\n    2.3,\n    2.2,\n    2.1,\n    2.0,\n]\n\n# Custom style for 4800x2700\ncustom_style = Style(\n    background=PAGE_BG,\n    plot_background=PAGE_BG,\n    foreground=INK,\n    foreground_strong=INK,\n    foreground_subtle=INK_MUTED,\n    colors=IMPRINT,\n    title_font_size=28,\n    label_font_size=18,\n    major_label_font_size=16,\n    legend_font_size=16,\n    value_font_size=14,\n    stroke_width=3,\n    opacity=0.9,\n    opacity_hover=1.0,\n)\n\n# Create Radar chart (polar line visualization)\nchart = pygal.Radar(\n    width=4800,\n    height=2700,\n    style=custom_style,\n    title=\"polar-line · pygal · anyplot.ai\",\n    show_legend=True,\n    legend_at_bottom=True,\n    legend_box_size=24,\n    dots_size=16,\n    stroke_style={\"width\": 3},\n    fill=False,\n    show_dots=True,\n    inner_radius=0.15,\n    margin=50,\n    margin_top=100,\n    margin_bottom=150,\n)\n\n# Set angular labels (hours)\nchart.x_labels = hours\n\n# Add wind speed series\nchart.add(\"Breezy Day\", day_1)\nchart.add(\"Calm Day\", day_2)\n\n# Render to files\nchart.render_to_file(f\"plot-{THEME}.html\")\nchart.render_to_png(f\"plot-{THEME}.png\")\n"}