{"spec_id":"polar-bar","library":"seaborn","language":"python","code":"\"\"\" anyplot.ai\npolar-bar: Polar Bar Chart (Wind Rose)\nLibrary: seaborn 0.13.2 | Python 3.13.13\nQuality: 90/100 | Created: 2026-05-13\n\"\"\"\n\nimport os\nimport sys\n\n\n# Remove current directory from path to avoid shadowing by matplotlib.py in this directory\nsys.path = [p for p in sys.path if p not in (\"\", \".\", os.path.dirname(__file__))]\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n\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\"\n\nIMPRINT = [\"#009E73\", \"#C475FD\", \"#4467A3\", \"#BD8233\", \"#AE3030\", \"#2ABCCD\"]\n\n# Data\nnp.random.seed(42)\ndirections = [\"N\", \"NNE\", \"NE\", \"ENE\", \"E\", \"ESE\", \"SE\", \"SSE\", \"S\", \"SSW\", \"SW\", \"WSW\", \"W\", \"WSW\", \"NW\", \"NNW\"]\nangles = np.linspace(0, 2 * np.pi, len(directions), endpoint=False)\n\nwind_speeds = np.array([45, 38, 52, 41, 35, 48, 42, 39, 36, 44, 50, 43, 47, 46, 40, 37])\n\n# Plot\nfig = plt.figure(figsize=(16, 9), facecolor=PAGE_BG)\nax = fig.add_subplot(111, projection=\"polar\")\nax.set_facecolor(PAGE_BG)\n\nbars = ax.bar(angles, wind_speeds, width=0.35, alpha=0.8, color=IMPRINT[0], edgecolor=INK_SOFT, linewidth=1.5)\n\n# Style\nax.set_theta_zero_location(\"N\")\nax.set_theta_direction(-1)\nax.set_xticks(angles)\nax.set_xticklabels(directions, fontsize=18, color=INK_SOFT)\nax.set_ylim(0, max(wind_speeds) * 1.1)\n\nax.set_yticklabels([])\ny_ticks = ax.get_yticks()\nax.set_yticks(y_ticks)\nax.set_yticklabels([f\"{int(y)}\" for y in y_ticks], fontsize=14, color=INK_SOFT)\n\nax.set_title(\"polar-bar · seaborn · anyplot.ai\", fontsize=24, fontweight=\"medium\", color=INK, pad=20)\nax.grid(True, alpha=0.15, color=INK_SOFT, linewidth=0.8)\n\nfor spine in ax.spines.values():\n    spine.set_color(INK_SOFT)\n    spine.set_linewidth(1)\n\nplt.tight_layout()\nplt.savefig(f\"plot-{THEME}.png\", dpi=300, bbox_inches=\"tight\", facecolor=PAGE_BG)\n"}