{"spec_id":"histogram-stepwise","library":"seaborn","language":"python","code":"\"\"\" anyplot.ai\nhistogram-stepwise: Step Histogram\nLibrary: seaborn 0.13.2 | Python 3.13.13\nQuality: 88/100 | Updated: 2026-05-12\n\"\"\"\n\nimport os\n\nimport matplotlib.pyplot as plt\nimport numpy as np\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\n# Okabe-Ito palette — positions 1 and 2\nIMPRINT = [\"#009E73\", \"#C475FD\"]\n\n# Configure seaborn theme\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 - Simulating response times (ms) for two different services\nnp.random.seed(42)\nservice_a = np.random.exponential(scale=50, size=500) + 20\nservice_b = np.random.exponential(scale=80, size=500) + 40\n\n# Plot\nfig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)\nax.set_facecolor(PAGE_BG)\n\n# Step histograms\nsns.histplot(service_a, bins=30, element=\"step\", fill=False, color=IMPRINT[0], linewidth=3, label=\"Service A\", ax=ax)\nsns.histplot(service_b, bins=30, element=\"step\", fill=False, color=IMPRINT[1], linewidth=3, label=\"Service B\", ax=ax)\n\n# Style\nax.set_xlabel(\"Response Time (ms)\", fontsize=20, color=INK)\nax.set_ylabel(\"Count\", fontsize=20, color=INK)\nax.set_title(\"histogram-stepwise · seaborn · anyplot.ai\", fontsize=24, color=INK, fontweight=\"medium\")\nax.tick_params(axis=\"both\", labelsize=16, colors=INK_SOFT)\nax.legend(fontsize=16, loc=\"upper right\", framealpha=0.95)\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)\nax.yaxis.grid(True, alpha=0.10, linewidth=0.8, color=INK_SOFT)\n\n# Save\nplt.tight_layout()\nplt.savefig(f\"plot-{THEME}.png\", dpi=300, bbox_inches=\"tight\", facecolor=PAGE_BG)\n"}