{"spec_id":"radar-multi","library":"plotly","language":"python","code":"\"\"\" anyplot.ai\nradar-multi: Multi-Series Radar Chart\nLibrary: plotly 6.7.0 | Python 3.13.13\nQuality: 89/100 | Updated: 2026-05-07\n\"\"\"\n\nimport os\n\nimport plotly.graph_objects as go\n\n\n# Theme tokens\nTHEME = os.getenv(\"ANYPLOT_THEME\", \"light\")\nPAGE_BG = \"#FAF8F1\" if THEME == \"light\" else \"#1A1A17\"\nELEVATED_BG = \"#FFFDF6\" if THEME == \"light\" else \"#242420\"\nINK = \"#1A1A17\" if THEME == \"light\" else \"#F0EFE8\"\nINK_SOFT = \"#4A4A44\" if THEME == \"light\" else \"#B8B7B0\"\nGRID = \"rgba(26, 26, 23, 0.10)\" if THEME == \"light\" else \"rgba(240, 239, 232, 0.10)\"\n\n# Okabe-Ito palette (first series always #009E73)\nIMPRINT = [\"#009E73\", \"#C475FD\", \"#4467A3\"]\n\n# Data - Product comparison across multiple attributes\ncategories = [\"Performance\", \"Reliability\", \"Price Value\", \"Support\", \"Ease of Use\", \"Features\"]\n\n# Three products with different strengths\nproduct_a = [85, 90, 70, 80, 75, 88]  # Strong overall, premium\nproduct_b = [75, 65, 95, 70, 90, 60]  # Budget-friendly, easy to use\nproduct_c = [95, 75, 60, 85, 65, 92]  # High-performance, feature-rich\n\n# Close the polygon by repeating the first value\ncategories_closed = categories + [categories[0]]\nproduct_a_closed = product_a + [product_a[0]]\nproduct_b_closed = product_b + [product_b[0]]\nproduct_c_closed = product_c + [product_c[0]]\n\n# Create radar chart\nfig = go.Figure()\n\n# Product A - Okabe-Ito green\nfig.add_trace(\n    go.Scatterpolar(\n        r=product_a_closed,\n        theta=categories_closed,\n        fill=\"toself\",\n        fillcolor=\"rgba(0, 158, 115, 0.25)\",\n        line={\"color\": IMPRINT[0], \"width\": 3},\n        name=\"Product A (Premium)\",\n        marker={\"size\": 10},\n    )\n)\n\n# Product B - Okabe-Ito vermillion\nfig.add_trace(\n    go.Scatterpolar(\n        r=product_b_closed,\n        theta=categories_closed,\n        fill=\"toself\",\n        fillcolor=\"rgba(196, 117, 253, 0.25)\",\n        line={\"color\": IMPRINT[1], \"width\": 3},\n        name=\"Product B (Budget)\",\n        marker={\"size\": 10},\n    )\n)\n\n# Product C - Okabe-Ito blue\nfig.add_trace(\n    go.Scatterpolar(\n        r=product_c_closed,\n        theta=categories_closed,\n        fill=\"toself\",\n        fillcolor=\"rgba(68, 103, 163, 0.25)\",\n        line={\"color\": IMPRINT[2], \"width\": 3},\n        name=\"Product C (Pro)\",\n        marker={\"size\": 10},\n    )\n)\n\n# Layout with theme-adaptive styling\nfig.update_layout(\n    title={\n        \"text\": \"radar-multi · plotly · anyplot.ai\",\n        \"font\": {\"size\": 28, \"color\": INK},\n        \"x\": 0.5,\n        \"xanchor\": \"center\",\n    },\n    polar={\n        \"radialaxis\": {\n            \"visible\": True,\n            \"range\": [0, 100],\n            \"tickfont\": {\"size\": 18, \"color\": INK_SOFT},\n            \"tickvals\": [20, 40, 60, 80, 100],\n            \"gridcolor\": GRID,\n            \"linecolor\": INK_SOFT,\n        },\n        \"angularaxis\": {\"tickfont\": {\"size\": 20, \"color\": INK_SOFT}, \"linecolor\": INK_SOFT, \"gridcolor\": GRID},\n        \"bgcolor\": PAGE_BG,\n    },\n    legend={\n        \"font\": {\"size\": 18, \"color\": INK_SOFT},\n        \"x\": 1.02,\n        \"y\": 0.5,\n        \"xanchor\": \"left\",\n        \"yanchor\": \"middle\",\n        \"bgcolor\": ELEVATED_BG,\n        \"bordercolor\": INK_SOFT,\n        \"borderwidth\": 1,\n    },\n    template=\"plotly_white\",\n    margin={\"l\": 100, \"r\": 120, \"t\": 100, \"b\": 100},\n    paper_bgcolor=PAGE_BG,\n    plot_bgcolor=PAGE_BG,\n    font={\"color\": INK},\n)\n\n# Save as PNG and HTML\nfig.write_image(f\"plot-{THEME}.png\", width=1600, height=900, scale=3)\nfig.write_html(f\"plot-{THEME}.html\", include_plotlyjs=\"cdn\")\n"}