{"spec_id":"point-basic","library":"seaborn","language":"python","code":"\"\"\" anyplot.ai\npoint-basic: Point Estimate Plot\nLibrary: seaborn 0.13.2 | Python 3.13.13\nQuality: 91/100 | Updated: 2026-05-12\n\"\"\"\n\nimport os\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nimport seaborn as sns\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\"\n\nBRAND = \"#009E73\"  # Okabe-Ito position 1 — first series\nREF_COLOR = \"#C475FD\"  # Okabe-Ito position 2 — reference line\n\nsns.set_theme(\n    style=\"ticks\",\n    rc={\n        \"figure.facecolor\": PAGE_BG,\n        \"axes.facecolor\": PAGE_BG,\n        \"axes.edgecolor\": INK_SOFT,\n        \"axes.labelcolor\": INK,\n        \"text.color\": INK,\n        \"xtick.color\": INK_SOFT,\n        \"ytick.color\": INK_SOFT,\n        \"grid.color\": INK,\n        \"grid.alpha\": 0.10,\n        \"legend.facecolor\": ELEVATED_BG,\n        \"legend.edgecolor\": INK_SOFT,\n    },\n)\n\n# Data: API endpoint response times (ms) — log-normal for realistic right-skewed latency\nnp.random.seed(42)\nendpoints = [\"Auth Service\", \"Search API\", \"Product Catalog\", \"Cart Service\", \"Payment API\", \"Analytics\"]\n# (mu, sigma) for log-normal → naturally asymmetric bootstrap CIs\nlognorm_params = [\n    (3.8, 0.40),  # Auth Service:      ~50ms mean\n    (4.7, 0.50),  # Search API:       ~130ms mean\n    (4.4, 0.35),  # Product Catalog:   ~90ms mean\n    (4.0, 0.45),  # Cart Service:      ~60ms mean\n    (4.5, 0.30),  # Payment API:      ~100ms mean\n    (5.1, 0.60),  # Analytics:        ~200ms mean\n]\n\nrecords = []\nfor endpoint, (mu, sigma) in zip(endpoints, lognorm_params, strict=True):\n    times = np.random.lognormal(mu, sigma, 80)\n    for t in times:\n        records.append({\"Endpoint\": endpoint, \"Response Time (ms)\": t})\n\ndf = pd.DataFrame(records)\n\n# Plot\nfig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)\nax.set_facecolor(PAGE_BG)\n\n# Seaborn native 95% bootstrap CI — asymmetric due to log-normal skew\nsns.pointplot(\n    data=df,\n    x=\"Response Time (ms)\",\n    y=\"Endpoint\",\n    orient=\"h\",\n    color=BRAND,\n    markers=\"o\",\n    markersize=12,\n    linestyle=\"none\",\n    errorbar=(\"ci\", 95),\n    err_kws={\"linewidth\": 2.5},\n    capsize=0.3,\n    ax=ax,\n)\n\n# Reference line at overall mean\noverall_mean = df[\"Response Time (ms)\"].mean()\nax.axvline(\n    x=overall_mean,\n    color=REF_COLOR,\n    linestyle=\"--\",\n    linewidth=2.5,\n    alpha=0.85,\n    label=f\"Overall Mean ({overall_mean:.0f} ms)\",\n)\n\n# Style\nax.set_xlabel(\"Response Time (ms)\", fontsize=20, color=INK)\nax.set_ylabel(\"API Endpoint\", fontsize=20, color=INK)\nax.set_title(\"point-basic · seaborn · anyplot.ai\", fontsize=24, fontweight=\"medium\", color=INK)\nax.tick_params(axis=\"both\", labelsize=16)\nax.spines[\"top\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nax.xaxis.grid(True, alpha=0.10, linewidth=0.8)\n\nax.legend(fontsize=16, loc=\"upper right\", frameon=True)\n\nplt.tight_layout()\nplt.savefig(f\"plot-{THEME}.png\", dpi=300, bbox_inches=\"tight\", facecolor=PAGE_BG)\n"}