{"spec_id":"line-filled","library":"plotnine","language":"python","code":"\"\"\" anyplot.ai\nline-filled: Filled Line Plot\nLibrary: plotnine 0.15.4 | Python 3.13.13\nQuality: 82/100 | Updated: 2026-05-12\n\"\"\"\n\nimport os\n\nimport numpy as np\nimport pandas as pd\nfrom plotnine import (\n    aes,\n    element_line,\n    element_rect,\n    element_text,\n    geom_area,\n    geom_line,\n    ggplot,\n    labs,\n    scale_x_continuous,\n    theme,\n    theme_minimal,\n)\n\n# Theme tokens\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\"\nBRAND = \"#009E73\"\n\n# Data - Monthly website traffic over a year\nnp.random.seed(42)\nmonths = np.arange(1, 13)\nbase_traffic = 50000 + np.cumsum(np.random.randn(12) * 5000)\nseasonal = 10000 * np.sin(np.pi * months / 6)\nvisitors = base_traffic + seasonal + np.random.randn(12) * 3000\nvisitors = np.maximum(visitors, 20000)\n\ndf = pd.DataFrame({\"Month\": months, \"Visitors\": visitors})\n\n# Plot\nplot = (\n    ggplot(df, aes(x=\"Month\", y=\"Visitors\"))\n    + geom_area(fill=BRAND, alpha=0.4)\n    + geom_line(color=BRAND, size=2)\n    + labs(\n        x=\"Month\",\n        y=\"Website Visitors\",\n        title=\"line-filled · plotnine · anyplot.ai\",\n    )\n    + scale_x_continuous(breaks=range(1, 13))\n    + theme_minimal()\n    + theme(\n        figure_size=(16, 9),\n        plot_background=element_rect(fill=PAGE_BG, color=PAGE_BG),\n        panel_background=element_rect(fill=PAGE_BG, color=PAGE_BG),\n        panel_grid_major=element_line(color=INK, size=0.3, alpha=0.10),\n        panel_grid_minor=element_line(alpha=0),\n        panel_border=element_rect(color=INK_SOFT, fill=None),\n        axis_title=element_text(size=20, color=INK),\n        axis_text=element_text(size=16, color=INK_SOFT),\n        axis_line=element_line(color=INK_SOFT, size=0.5),\n        plot_title=element_text(size=24, color=INK),\n    )\n)\n\n# Save\nplot.save(f\"plot-{THEME}.png\", dpi=300, verbose=False)\n"}