{"spec_id":"line-filled","library":"plotly","language":"python","code":"\"\"\" anyplot.ai\nline-filled: Filled Line Plot\nLibrary: plotly 6.7.0 | Python 3.13.13\nQuality: 89/100 | Updated: 2026-05-12\n\"\"\"\n\nimport os\n\nimport numpy as np\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)\"\nBRAND = \"#009E73\"  # Okabe-Ito position 1\n\n# Data - Monthly website traffic over a year\nnp.random.seed(42)\nmonths = np.arange(1, 13)\nmonth_labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n\n# Generate realistic website traffic pattern with more variability\nbase_traffic = 50\nseasonal = 15 * np.sin(2 * np.pi * (months - 3) / 12)\ntrend = 2 * months\nnoise = np.random.normal(0, 8, len(months))  # Increased noise for more variability\ntraffic = base_traffic + seasonal + trend + noise\ntraffic = np.maximum(traffic, 10)\n\n# Create figure with filled area\nfig = go.Figure()\nfig.add_trace(\n    go.Scatter(\n        x=month_labels,\n        y=traffic,\n        mode=\"lines\",\n        name=\"Website Traffic\",\n        line=dict(color=BRAND, width=4),\n        fill=\"tozeroy\",\n        fillcolor=\"rgba(0, 158, 115, 0.35)\",\n        hovertemplate=\"%{x}: %{y:.1f}K visitors<extra></extra>\",\n    )\n)\n\n# Update layout with theme-adaptive colors\nfig.update_layout(\n    title=dict(text=\"line-filled · plotly · anyplot.ai\", font=dict(size=28, color=INK), x=0.5, xanchor=\"center\"),\n    xaxis=dict(\n        title=dict(text=\"Month\", font=dict(size=22, color=INK)),\n        tickfont=dict(size=18, color=INK_SOFT),\n        showgrid=True,\n        gridcolor=GRID,\n        gridwidth=1,\n        linecolor=INK_SOFT,\n        zerolinecolor=INK_SOFT,\n    ),\n    yaxis=dict(\n        title=dict(text=\"Website Visitors (thousands)\", font=dict(size=22, color=INK)),\n        tickfont=dict(size=18, color=INK_SOFT),\n        showgrid=True,\n        gridcolor=GRID,\n        gridwidth=1,\n        rangemode=\"tozero\",\n        linecolor=INK_SOFT,\n        zerolinecolor=INK_SOFT,\n    ),\n    paper_bgcolor=PAGE_BG,\n    plot_bgcolor=PAGE_BG,\n    font=dict(color=INK),\n    showlegend=False,\n    margin=dict(l=100, r=60, t=100, b=80),\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"}