{"spec_id":"point-basic","library":"matplotlib","language":"python","code":"\"\"\" anyplot.ai\npoint-basic: Point Estimate Plot\nLibrary: matplotlib 3.10.9 | Python 3.13.13\nQuality: 86/100 | Updated: 2026-05-11\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\"\nELEVATED_BG = \"#FFFDF6\" if THEME == \"light\" else \"#242420\"\nINK = \"#1A1A17\" if THEME == \"light\" else \"#F0EFE8\"\nINK_SOFT = \"#4A4A44\" if THEME == \"light\" else \"#B8B7B0\"\nBRAND = \"#009E73\"  # Okabe-Ito position 1\n\n# Data - Clinical trial treatment effect estimates with 95% confidence intervals\nnp.random.seed(42)\ntreatments = [\"Placebo\", \"Treatment A\", \"Treatment B\", \"Treatment C\", \"Treatment D\", \"Treatment E\"]\n\n# Simulated effect sizes (standardized mean differences) with confidence intervals\nestimates = np.array([0.0, 0.35, 0.58, 0.42, 0.71, 0.28])\nci_lower = np.array([-0.15, 0.10, 0.35, 0.18, 0.48, 0.02])\nci_upper = np.array([0.15, 0.60, 0.81, 0.66, 0.94, 0.54])\n\n# Calculate errors for errorbar (asymmetric)\nlower_errors = estimates - ci_lower\nupper_errors = ci_upper - estimates\n\n# Plot\nfig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)\nax.set_facecolor(PAGE_BG)\n\n# Create horizontal point estimate plot with error bars\ny_positions = np.arange(len(treatments))\n\nax.errorbar(\n    estimates,\n    y_positions,\n    xerr=[lower_errors, upper_errors],\n    fmt=\"o\",\n    color=BRAND,\n    markersize=14,\n    markeredgecolor=PAGE_BG,\n    markeredgewidth=1,\n    capsize=8,\n    capthick=2.5,\n    elinewidth=2.5,\n    ecolor=BRAND,\n)\n\n# Styling\nax.set_yticks(y_positions)\nax.set_yticklabels(treatments, fontsize=18, color=INK_SOFT)\nax.set_xlabel(\"Effect Size\", fontsize=20, color=INK)\nax.set_ylabel(\"Treatment Group\", fontsize=20, color=INK)\nax.set_title(\"point-basic · matplotlib · anyplot.ai\", fontsize=24, fontweight=\"medium\", color=INK)\nax.tick_params(axis=\"x\", labelsize=16, colors=INK_SOFT)\n\n# Set x-axis limits with padding\nax.set_xlim(-0.4, 1.1)\nax.set_ylim(-0.5, len(treatments) - 0.5)\n\n# Grid - subtle vertical lines only\nax.grid(True, axis=\"x\", alpha=0.10, linewidth=0.8, color=INK)\nax.set_axisbelow(True)\n\n# Spines\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nfor spine in (\"left\", \"bottom\"):\n    ax.spines[spine].set_color(INK_SOFT)\n\n# Invert y-axis so first treatment is at top\nax.invert_yaxis()\n\nplt.tight_layout()\nplt.savefig(f\"plot-{THEME}.png\", dpi=300, bbox_inches=\"tight\", facecolor=PAGE_BG)\n"}