{"spec_id":"line-filled","library":"pygal","language":"python","code":"\"\"\" anyplot.ai\nline-filled: Filled Line Plot\nLibrary: pygal 3.1.0 | Python 3.13.13\nQuality: 70/100 | Updated: 2026-05-12\n\"\"\"\n\nimport numpy as np\nimport pygal\nfrom pygal.style import Style\n\n\n# Data - Monthly website traffic over a year\nnp.random.seed(42)\nmonths = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n# Simulating website traffic with seasonal trend and some noise\nbase_traffic = 50000\nseasonal = np.array([0.8, 0.85, 0.95, 1.0, 1.1, 1.15, 1.2, 1.1, 1.05, 0.95, 0.9, 1.3])  # Holiday spike in Dec\nnoise = np.random.normal(0, 2000, 12)\ntraffic = (base_traffic * seasonal + noise).astype(int)\n\n# Custom style for large canvas\ncustom_style = Style(\n    background=\"white\",\n    plot_background=\"white\",\n    foreground=\"#333333\",\n    foreground_strong=\"#333333\",\n    foreground_subtle=\"#666666\",\n    colors=(\"#306998\",),  # Python Blue for the line/fill\n    title_font_size=72,\n    label_font_size=48,\n    major_label_font_size=42,\n    legend_font_size=42,\n    value_font_size=36,\n    stroke_width=5,\n    opacity=0.4,  # Fill opacity\n    opacity_hover=0.6,\n)\n\n# Create filled line chart\nchart = pygal.Line(\n    width=4800,\n    height=2700,\n    style=custom_style,\n    title=\"line-filled · pygal · pyplots.ai\",\n    x_title=\"Month\",\n    y_title=\"Page Views\",\n    fill=True,  # Enable fill under the line\n    show_legend=True,\n    show_y_guides=True,\n    show_x_guides=False,\n    dots_size=8,\n    stroke_style={\"width\": 5},\n    legend_at_bottom=False,\n    truncate_legend=-1,\n    margin=50,\n    x_label_rotation=0,\n)\n\n# Add data\nchart.x_labels = months\nchart.add(\"Website Traffic\", traffic.tolist())\n\n# Save as PNG and HTML\nchart.render_to_png(\"plot.png\")\nchart.render_to_file(\"plot.html\")\n"}