{"spec_id":"line-markers","library":"letsplot","language":"python","code":"\"\"\" anyplot.ai\nline-markers: Line Plot with Markers\nLibrary: letsplot 4.9.0 | Python 3.13.13\nQuality: 91/100 | Updated: 2026-05-12\n\"\"\"\n\nimport os\n\nimport numpy as np\nimport pandas as pd\nfrom lets_plot import *\n\n\nLetsPlot.setup_html()\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\"\n\n# Okabe-Ito palette\nIMPRINT = [\"#009E73\", \"#C475FD\", \"#4467A3\"]\n\n# Data - Quarterly product performance metrics\nnp.random.seed(42)\nquarters = np.arange(1, 13)\n\n# Three product lines with different growth patterns\nproduct_a = 45 + np.cumsum(np.random.randn(12) * 3) + np.arange(12) * 2\nproduct_b = 60 + np.cumsum(np.random.randn(12) * 4) + np.arange(12) * 1.5\nproduct_c = 35 + np.cumsum(np.random.randn(12) * 2.5) + np.arange(12) * 2.5\n\ndf = pd.DataFrame(\n    {\n        \"Quarter\": list(quarters) * 3,\n        \"Revenue\": np.concatenate([product_a, product_b, product_c]),\n        \"Product\": [\"Product A\"] * 12 + [\"Product B\"] * 12 + [\"Product C\"] * 12,\n    }\n)\n\n# Create plot\nplot = (\n    ggplot(df, aes(x=\"Quarter\", y=\"Revenue\", color=\"Product\"))\n    + geom_line(size=2.5)\n    + geom_point(size=6, alpha=0.9)\n    + scale_color_manual(values=IMPRINT)\n    + scale_x_continuous(breaks=list(range(1, 13)))\n    + labs(x=\"Quarter\", y=\"Revenue (Million USD)\", title=\"line-markers · letsplot · anyplot.ai\")\n    + theme_minimal()\n    + theme(\n        plot_background=element_rect(fill=PAGE_BG, color=PAGE_BG),\n        panel_background=element_rect(fill=PAGE_BG),\n        panel_grid_major=element_line(color=INK_SOFT, size=0.3),\n        plot_title=element_text(size=24, color=INK, face=\"bold\"),\n        axis_title=element_text(size=20, color=INK),\n        axis_text=element_text(size=16, color=INK_SOFT),\n        axis_line=element_line(color=INK_SOFT, size=0.5),\n        legend_background=element_rect(fill=ELEVATED_BG),\n        legend_text=element_text(size=16, color=INK_SOFT),\n        legend_title=element_text(size=18, color=INK),\n        legend_position=\"right\",\n    )\n    + ggsize(1600, 900)\n)\n\n# Save outputs\nggsave(plot, f\"plot-{THEME}.png\", path=\".\", scale=3)\nggsave(plot, f\"plot-{THEME}.html\", path=\".\")\n"}