{"spec_id":"radar-multi","library":"pygal","language":"python","code":"\"\"\" anyplot.ai\nradar-multi: Multi-Series Radar Chart\nLibrary: pygal 3.1.3 | Python 3.13.15\nQuality: 90/100 | Updated: 2026-08-17\n\"\"\"\n\nimport os\n\nimport pygal\nfrom pygal.style import Style\n\n\n# Theme tokens (see prompts/default-style-guide.md \"Background\" + \"Theme-adaptive Chrome\")\nTHEME = os.getenv(\"ANYPLOT_THEME\", \"light\")\nPAGE_BG = \"#FAF8F1\" if THEME == \"light\" else \"#1A1A17\"\nINK = \"#1A1A17\" if THEME == \"light\" else \"#F0EFE8\"\nINK_MUTED = \"#6B6A63\" if THEME == \"light\" else \"#A8A79F\"\n\n# Imprint categorical palette — position 1 is always the brand green\nIMPRINT_PALETTE = (\"#009E73\", \"#C475FD\", \"#4467A3\", \"#BD8233\", \"#AE3030\", \"#2ABCCD\", \"#954477\", \"#99B314\")\n\n# Data - Team performance comparison across skill dimensions\ncategories = [\"Communication\", \"Technical\", \"Leadership\", \"Creativity\", \"Teamwork\", \"Problem Solving\"]\nteams = [\n    (\"Alpha Team\", [85, 90, 75, 80, 88, 82]),\n    (\"Beta Team\", [78, 72, 85, 90, 70, 88]),\n    (\"Gamma Team\", [65, 88, 70, 75, 92, 78]),\n]\n\n# Highest overall average becomes the visual \"hero\" series — a bolder, solid\n# stroke and larger dots build a focal point so the viewer immediately spots\n# the top all-round team, while the other two recede behind a thinner dashed\n# outline.\nhero_name, _ = max(teams, key=lambda t: sum(t[1]) / len(t[1]))\n\n# Style — theme-adaptive chrome, Imprint palette, sizing tuned for the 2400x2400 canvas\ncustom_style = Style(\n    font_family='\"Liberation Sans\", \"DejaVu Sans\", Arial, sans-serif',\n    background=PAGE_BG,\n    plot_background=PAGE_BG,\n    foreground=INK,\n    foreground_strong=INK,\n    foreground_subtle=INK_MUTED,\n    colors=IMPRINT_PALETTE,\n    title_font_size=66,\n    label_font_size=56,\n    major_label_font_size=44,\n    legend_font_size=44,\n    value_font_size=36,\n    opacity=0.25,\n    opacity_hover=0.5,\n)\n\n# Plot — square canvas for the symmetric radar layout. Legend moved to the\n# bottom (rather than the default left column) so the polar plot area is no\n# longer squeezed toward the top-right of the canvas, balancing whitespace.\nchart = pygal.Radar(\n    width=2400,\n    height=2400,\n    style=custom_style,\n    title=\"radar-multi · python · pygal · anyplot.ai\",\n    show_legend=True,\n    legend_at_bottom=True,\n    legend_at_bottom_columns=3,\n    show_dots=True,\n    fill=True,\n    inner_radius=0.1,\n    range=(0, 100),\n    margin=30,\n    spacing=16,\n)\nchart.x_labels = categories\n\n# Add data series — hero team gets a bold solid stroke + larger dots, the\n# other two recede behind a thinner dashed outline.\nfor team_name, values in teams:\n    is_hero = team_name == hero_name\n    chart.add(\n        team_name,\n        values,\n        dots_size=12 if is_hero else 7,\n        stroke_style={\"width\": 6, \"linecap\": \"round\", \"linejoin\": \"round\"}\n        if is_hero\n        else {\"width\": 2.5, \"linecap\": \"round\", \"linejoin\": \"round\", \"dasharray\": \"12,6\"},\n    )\n\n# Save\nchart.render_to_png(f\"plot-{THEME}.png\")\nwith open(f\"plot-{THEME}.html\", \"wb\") as f:\n    f.write(chart.render())\n"}