{"spec_id":"line-styled","library":"matplotlib","language":"python","code":"\"\"\" anyplot.ai\nline-styled: Styled Line Plot\nLibrary: matplotlib 3.10.9 | Python 3.13.13\nQuality: 93/100 | Updated: 2026-05-12\n\"\"\"\n\nimport os\n\nimport matplotlib.pyplot as plt\nimport numpy as np\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\"\n\n# Okabe-Ito palette\nCOLORS = [\"#009E73\", \"#C475FD\", \"#4467A3\", \"#BD8233\"]\n\n# Data - CPU performance benchmarks over time\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# Simulated performance scores for different processors\nbase_score = 100\nprocessor_a = base_score + np.cumsum(np.random.randn(12) * 3 + 2)\nprocessor_b = base_score + np.cumsum(np.random.randn(12) * 4 + 1.5)\nprocessor_c = base_score + np.cumsum(np.random.randn(12) * 2 + 2.5)\nprocessor_d = base_score + np.cumsum(np.random.randn(12) * 3 + 0.5)\n\nseries_data = [processor_a, processor_b, processor_c, processor_d]\nseries_names = [\"Series 1\", \"Series 2\", \"Series 3\", \"Series 4\"]\nline_styles = [\"-\", \"--\", \":\", \"-.\"]\n\n# Plot\nfig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)\nax.set_facecolor(PAGE_BG)\n\n# Plot lines with different styles\nfor i, (data, name, style) in enumerate(\n    zip(series_data, series_names, line_styles, strict=True)\n):\n    ax.plot(months, data, linestyle=style, linewidth=3, color=COLORS[i], label=name)\n\n# Style\nax.set_xlabel(\"Month\", fontsize=20, color=INK)\nax.set_ylabel(\"Performance Score\", fontsize=20, color=INK)\nax.set_title(\"line-styled · matplotlib · anyplot.ai\", fontsize=24, fontweight=\"medium\", color=INK)\nax.set_xticks(months)\nax.set_xticklabels(month_labels)\nax.tick_params(axis=\"both\", labelsize=16, colors=INK_SOFT)\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nfor s in (\"left\", \"bottom\"):\n    ax.spines[s].set_color(INK_SOFT)\nax.yaxis.grid(True, alpha=0.15, linewidth=0.8, color=INK)\n\nleg = ax.legend(fontsize=16, loc=\"upper left\")\nif leg:\n    leg.get_frame().set_facecolor(PAGE_BG)\n    leg.get_frame().set_edgecolor(INK_SOFT)\n    plt.setp(leg.get_texts(), color=INK_SOFT)\n\nplt.tight_layout()\nplt.savefig(f\"plot-{THEME}.png\", dpi=300, bbox_inches=\"tight\", facecolor=PAGE_BG)\n"}