{"spec_id":"line-basic","library":"pygal","language":"python","code":"\"\"\" anyplot.ai\nline-basic: Basic Line Plot\nLibrary: pygal 3.1.0 | Python 3.13.13\nQuality: 84/100 | Updated: 2026-04-29\n\"\"\"\n\nimport os\nimport sys\n\n\n# Pop script directory so local pygal.py doesn't shadow the installed package\n_script_dir = sys.path.pop(0)\n\nimport pygal\nfrom pygal.style import Style\n\n\nsys.path.insert(0, _script_dir)\n\nTHEME = os.getenv(\"ANYPLOT_THEME\", \"light\")\nPAGE_BG = \"#FAF8F1\" if THEME == \"light\" else \"#1A1A17\"\nINK = \"#1A1A17\" if THEME == \"light\" else \"#F0EFE8\"\nINK_MUTED = \"#6B6A63\" if THEME == \"light\" else \"#A8A79F\"\n\nIMPRINT = (\"#009E73\", \"#C475FD\", \"#4467A3\", \"#BD8233\", \"#AE3030\", \"#2ABCCD\", \"#954477\")\n\n# Data\nmonths = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\ntemperatures = [2.3, 3.5, 7.2, 11.8, 16.4, 19.8, 22.1, 21.5, 17.6, 12.3, 7.1, 3.4]\n\n# Style\ncustom_style = Style(\n    background=PAGE_BG,\n    plot_background=PAGE_BG,\n    foreground=INK,\n    foreground_strong=INK,\n    foreground_subtle=INK_MUTED,\n    colors=IMPRINT,\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=3,\n)\n\n# Plot\nchart = pygal.Line(\n    width=4800,\n    height=2700,\n    title=\"line-basic · pygal · anyplot.ai\",\n    x_title=\"Month\",\n    y_title=\"Temperature (°C)\",\n    style=custom_style,\n    show_dots=True,\n    dots_size=8,\n    stroke_style={\"width\": 5},\n    show_y_guides=True,\n    show_x_guides=False,\n    x_label_rotation=0,\n    legend_at_bottom=True,\n    truncate_legend=-1,\n)\n\nchart.x_labels = months\nchart.add(\"Average Temperature\", temperatures)\n\n# Save\nchart.render_to_png(f\"plot-{THEME}.png\")\nwith open(f\"plot-{THEME}.html\", \"wb\") as f:\n    f.write(chart.render())\n"}