{"spec_id":"point-basic","library":"letsplot","language":"python","code":"\"\"\" anyplot.ai\npoint-basic: Point Estimate Plot\nLibrary: letsplot 4.9.0 | Python 3.13.13\nQuality: 89/100 | Updated: 2026-05-11\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\"\nRULE = \"rgba(26,26,23,0.10)\" if THEME == \"light\" else \"rgba(240,239,232,0.10)\"\n\nBRAND = \"#009E73\"\n\n# Data - Research study results with confidence intervals\nnp.random.seed(42)\ncategories = [\"Treatment A\", \"Treatment B\", \"Treatment C\", \"Control\", \"Placebo\"]\nestimates = [4.2, 5.8, 3.1, 2.5, 1.8]\nci_width = [0.9, 1.1, 0.7, 0.8, 0.6]\nlower = [e - w for e, w in zip(estimates, ci_width, strict=False)]\nupper = [e + w for e, w in zip(estimates, ci_width, strict=False)]\n\ndf = pd.DataFrame({\"group\": categories, \"estimate\": estimates, \"lower\": lower, \"upper\": upper})\n\n# Plot - Horizontal point estimate plot with confidence intervals\nplot = (\n    ggplot(df, aes(x=\"group\", y=\"estimate\", ymin=\"lower\", ymax=\"upper\"))\n    + geom_pointrange(color=BRAND, size=1.5, linewidth=1.5)\n    + geom_hline(yintercept=0, linetype=\"dashed\", color=INK_SOFT, size=0.8, alpha=0.5)\n    + labs(y=\"Effect Size (95% CI)\", x=\"Treatment Group\", title=\"point-basic · letsplot · anyplot.ai\")\n    + coord_flip()\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_x=element_line(color=RULE, size=0.3),\n        panel_grid_minor=element_blank(),\n        panel_grid_major_y=element_blank(),\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        plot_title=element_text(size=24, color=INK),\n    )\n    + ggsize(1600, 900)\n)\n\n# Save\nggsave(plot, f\"plot-{THEME}.png\", path=\".\", scale=3)\nggsave(plot, f\"plot-{THEME}.html\", path=\".\")\n"}