{"spec_id":"line-basic","library":"matplotlib","language":"python","code":"\"\"\" anyplot.ai\nline-basic: Basic Line Plot\nLibrary: matplotlib 3.11.2 | Python 3.14.9\nQuality: 83/100 | Updated: 2026-11-01\n\"\"\"\n\nimport os\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\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# Imprint palette: single series uses the brand green\nBRAND = \"#009E73\"\n\n# Columns: set these to your table's column names\nMONTH = \"Month\"  # role: x\nTEMPERATURE = \"Temperature (°C)\"  # role: y\n\n# Data: replace this block with your own table, for example df = pd.read_csv(\"temperature.csv\")\nnp.random.seed(42)\nmonth_numbers = np.arange(1, 13)\nbase_temp = 15 + 12 * np.sin((month_numbers - 4) * np.pi / 6)\nall_years = base_temp + np.random.randn(5, 12) * 2.5\ndf = pd.DataFrame(\n    {\n        MONTH: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n        TEMPERATURE: all_years.mean(axis=0),\n    }\n)\n\n# Plot\nfig, ax = plt.subplots(figsize=(8, 4.5), dpi=400, facecolor=PAGE_BG)\nax.set_facecolor(PAGE_BG)\n\nax.plot(\n    df[MONTH],\n    df[TEMPERATURE],\n    linewidth=2.5,\n    color=BRAND,\n    marker=\"o\",\n    markersize=6,\n    markerfacecolor=PAGE_BG,\n    markeredgecolor=BRAND,\n    markeredgewidth=1.5,\n)\n\n# Style\nax.tick_params(axis=\"both\", labelsize=8, labelcolor=INK_SOFT, length=0)\nax.set_xlabel(MONTH, fontsize=10, color=INK)\nax.set_ylabel(TEMPERATURE, fontsize=10, color=INK)\nax.set_title(\n    \"Monthly Temperature Trend · line-basic · matplotlib · anyplot.ai\", fontsize=12, fontweight=\"medium\", color=INK\n)\n\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)\n\nax.yaxis.grid(True, alpha=0.18, linewidth=0.8, color=INK)\n\nfig.subplots_adjust(left=0.08, right=0.97, top=0.9, bottom=0.12)\nplt.savefig(f\"plot-{THEME}.png\", dpi=400, facecolor=PAGE_BG)\n"}