{"spec_id":"rose-basic","library":"plotly","language":"python","code":"\"\"\" anyplot.ai\nrose-basic: Basic Rose Chart\nLibrary: plotly 6.9.0 | Python 3.13.14\nQuality: 90/100 | Updated: 2026-07-25\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# Imprint sequential colormap — brand green -> blue, single-polarity continuous data\nimprint_seq = [[0.0, \"#009E73\"], [1.0, \"#4467A3\"]]\n\n# Data - Monthly rainfall (mm) showing pronounced seasonal pattern\nmonths = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\nrainfall = [92, 74, 60, 45, 32, 18, 12, 22, 48, 75, 98, 105]\n\n# Plot\nfig = go.Figure()\n\nfig.add_trace(\n    go.Barpolar(\n        r=rainfall,\n        theta=months,\n        width=0.9,\n        marker={\n            \"color\": rainfall,\n            \"colorscale\": imprint_seq,\n            \"line\": {\"color\": PAGE_BG, \"width\": 2},\n            \"cmin\": 0,\n            \"cmax\": max(rainfall),\n        },\n        hovertemplate=\"<b>%{theta}</b><br>Rainfall: %{r} mm<extra></extra>\",\n    )\n)\n\nfig.update_layout(\n    autosize=False,\n    width=600,\n    height=600,\n    title={\n        \"text\": \"rose-basic · python · plotly · anyplot.ai\",\n        \"font\": {\"size\": 34, \"color\": INK},\n        \"x\": 0.5,\n        \"xanchor\": \"center\",\n    },\n    paper_bgcolor=PAGE_BG,\n    polar={\n        \"bgcolor\": PAGE_BG,\n        \"hole\": 0.08,\n        \"angularaxis\": {\n            \"tickfont\": {\"size\": 20, \"color\": INK_SOFT},\n            \"direction\": \"clockwise\",\n            \"rotation\": 90,\n            \"gridcolor\": GRID,\n            \"linecolor\": INK_SOFT,\n        },\n        \"radialaxis\": {\n            \"tickfont\": {\"size\": 15, \"color\": INK_SOFT},\n            \"gridcolor\": GRID,\n            \"linecolor\": INK_SOFT,\n            \"angle\": 285,\n            \"tickmode\": \"array\",\n            \"tickvals\": [25, 50, 75, 100],\n            \"ticktext\": [\"25 mm\", \"50 mm\", \"75 mm\", \"100 mm\"],\n        },\n    },\n    showlegend=False,\n    margin={\"l\": 60, \"r\": 60, \"t\": 90, \"b\": 60},\n)\n\n# Save\nfig.write_image(f\"plot-{THEME}.png\", width=600, height=600, scale=4)\nfig.write_html(f\"plot-{THEME}.html\", include_plotlyjs=\"cdn\")\n"}