{"spec_id":"histogram-cumulative","library":"seaborn","language":"python","code":"\"\"\" anyplot.ai\nhistogram-cumulative: Cumulative Histogram\nLibrary: seaborn 0.13.2 | Python 3.13.13\nQuality: 89/100 | Updated: 2026-05-11\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\"\nBRAND = \"#009E73\"\n\n# Data - Financial transaction amounts (realistic e-commerce scenario)\nnp.random.seed(42)\ntransactions = np.concatenate(\n    [\n        np.random.exponential(scale=25, size=400),  # Small purchases (majority)\n        np.random.normal(loc=120, scale=25, size=150),  # Medium purchases\n        np.random.normal(loc=300, scale=60, size=50),  # Large purchases\n    ]\n)\ntransactions = np.clip(transactions, 5, 500)\n\n# Plot\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    },\n)\n\nfig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)\n\nsns.histplot(\n    transactions,\n    bins=35,\n    cumulative=True,\n    stat=\"proportion\",\n    element=\"step\",\n    fill=True,\n    color=BRAND,\n    alpha=0.7,\n    linewidth=2.5,\n    edgecolor=BRAND,\n    ax=ax,\n)\n\n# Style\nax.set_xlabel(\"Transaction Amount ($)\", fontsize=20, color=INK)\nax.set_ylabel(\"Cumulative Proportion\", fontsize=20, color=INK)\nax.set_title(\"histogram-cumulative · seaborn · anyplot.ai\", fontsize=24, color=INK)\nax.tick_params(axis=\"both\", labelsize=16, colors=INK_SOFT)\nax.set_xlim(0, 500)\nax.set_ylim(0, 1.05)\nax.yaxis.grid(True, alpha=0.10, linewidth=0.8)\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\nplt.tight_layout()\nplt.savefig(f\"plot-{THEME}.png\", dpi=300, bbox_inches=\"tight\", facecolor=PAGE_BG)\n"}