{"spec_id":"scatter-text","library":"pygal","language":"python","code":"\"\"\" anyplot.ai\nscatter-text: Scatter Plot with Text Labels Instead of Points\nLibrary: pygal 3.1.0 | Python 3.13.13\nQuality: 83/100 | Created: 2026-05-17\n\"\"\"\n\nimport os\n\nimport pygal\nfrom pygal.style import Style\n\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\"\nBRAND = \"#009E73\"\n\nIMPRINT = (\"#009E73\", \"#C475FD\", \"#4467A3\", \"#BD8233\", \"#AE3030\", \"#2ABCCD\", \"#954477\")\n\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=28,\n    label_font_size=18,\n    major_label_font_size=16,\n    legend_font_size=16,\n    value_font_size=14,\n    stroke_width=2,\n)\n\n# Data: Product positioning (Price Competitiveness vs. Feature Completeness)\nproducts = [\n    {\"x\": 2.1, \"y\": 3.2, \"label\": \"Budget Start-up Kit\"},\n    {\"x\": 3.5, \"y\": 2.8, \"label\": \"Standard Pro\"},\n    {\"x\": 4.2, \"y\": 4.1, \"label\": \"Premium Suite\"},\n    {\"x\": 1.8, \"y\": 4.5, \"label\": \"Full Enterprise\"},\n    {\"x\": 3.9, \"y\": 1.9, \"label\": \"Lite Essentials\"},\n    {\"x\": 2.7, \"y\": 3.7, \"label\": \"Growth Package\"},\n    {\"x\": 4.6, \"y\": 3.3, \"label\": \"Elite Plus\"},\n    {\"x\": 1.2, \"y\": 2.1, \"label\": \"Basic Tier\"},\n    {\"x\": 3.3, \"y\": 4.8, \"label\": \"Advanced Max\"},\n    {\"x\": 4.8, \"y\": 2.5, \"label\": \"Performance Edge\"},\n]\n\n# Plot\nchart = pygal.XY(\n    style=custom_style,\n    width=4800,\n    height=2700,\n    title=\"scatter-text · Python · pygal · anyplot.ai\",\n    x_title=\"Price Competitiveness\",\n    y_title=\"Feature Completeness\",\n    show_legend=False,\n    show_dots=False,\n    show_y_guides=True,\n    dots_size=0,\n)\n\n# Add data series with text labels\nchart.add(\n    \"Products\",\n    [\n        {\n            \"value\": (p[\"x\"], p[\"y\"]),\n            \"label\": p[\"label\"],\n            \"color\": BRAND,\n        }\n        for p in products\n    ],\n)\n\n# Set axis ranges\nchart.range = (0, 5.5)\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"}