{ "cells": [ { "cell_type": "markdown", "id": "9fb2376b", "metadata": {}, "source": [ "# hist024_THStack_pads\n", "\n", "In this example three histograms are displayed on separate pads.\n", "If canvas divided in advance - provided subpads will be used by the THStack.\n", "\n", "\n", "\n", "\n", "**Author:** Sergey Linev \n", "This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:12 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "4ce65e25", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:28.056577Z", "iopub.status.busy": "2026-05-19T20:12:28.056462Z", "iopub.status.idle": "2026-05-19T20:12:28.366969Z", "shell.execute_reply": "2026-05-19T20:12:28.366508Z" } }, "outputs": [], "source": [ "auto hs = new THStack(\"hs\", \"Stacked 1D histograms\");" ] }, { "cell_type": "markdown", "id": "9d14ba38", "metadata": {}, "source": [ "Create three 1-d histograms and add them in the stack" ] }, { "cell_type": "code", "execution_count": 2, "id": "c29d5eb7", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:28.368631Z", "iopub.status.busy": "2026-05-19T20:12:28.368509Z", "iopub.status.idle": "2026-05-19T20:12:28.691931Z", "shell.execute_reply": "2026-05-19T20:12:28.691468Z" } }, "outputs": [], "source": [ "auto h1st = new TH1F(\"h1st\", \"test hstack 1\", 100, -4, 4);\n", "h1st->FillRandom(\"gaus\", 20000);\n", "hs->Add(h1st);\n", "\n", "auto h2st = new TH1F(\"h2st\", \"test hstack 2\", 100, -4, 4);\n", "h2st->FillRandom(\"gaus\", 15000);\n", "hs->Add(h2st);\n", "\n", "auto h3st = new TH1F(\"h3st\", \"test hstack 3\", 100, -4, 4);\n", "h3st->FillRandom(\"gaus\", 10000);\n", "hs->Add(h3st);\n", "\n", "auto c1 = new TCanvas(\"c1\", \"THStack drawing on pads\", 800, 800);" ] }, { "cell_type": "markdown", "id": "6e848827", "metadata": {}, "source": [ "prepare subpads for drawing of histograms" ] }, { "cell_type": "code", "execution_count": 3, "id": "6aee6fdd", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:28.693504Z", "iopub.status.busy": "2026-05-19T20:12:28.693397Z", "iopub.status.idle": "2026-05-19T20:12:28.897063Z", "shell.execute_reply": "2026-05-19T20:12:28.896631Z" } }, "outputs": [], "source": [ "c1->Divide(1, 3);" ] }, { "cell_type": "markdown", "id": "eda529fc", "metadata": {}, "source": [ "draw thstack on canvas with \"pads\" draw option" ] }, { "cell_type": "code", "execution_count": 4, "id": "b4ae0d85", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:28.906295Z", "iopub.status.busy": "2026-05-19T20:12:28.906178Z", "iopub.status.idle": "2026-05-19T20:12:29.109052Z", "shell.execute_reply": "2026-05-19T20:12:29.108600Z" } }, "outputs": [], "source": [ "c1->Add(hs, \"pads\");" ] }, { "cell_type": "markdown", "id": "7ffba9e7", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 5, "id": "d7c9ab19", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:12:29.110525Z", "iopub.status.busy": "2026-05-19T20:12:29.110413Z", "iopub.status.idle": "2026-05-19T20:12:29.314030Z", "shell.execute_reply": "2026-05-19T20:12:29.313638Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "