{ "cells": [ { "cell_type": "markdown", "id": "f63110d2", "metadata": {}, "source": [ "# gr103_zones\n", "into adjacent subpads + axis labels on the top and right side\n", "of the pads.\n", "\n", "See the [Divide documentation](https://root.cern/doc/master/classTPad.html#a2714ddd7ba72d5def84edc1fbaea8658)\n", "\n", "Note that the last 2 arguments in\n", " `c1->Divide(2,2,0,0)`\n", "define 0 space between the pads. With this, the axis labels where the pads\n", "touch may be cut, as in this tutorial. To avoid this, either add some spacing\n", "between pads (instead of 0) or change the limits of the plot in the pad (histos\n", "in this tutorial). E.g. `h3` could be defined as\n", " `TH2F *h3 = new TH2F(\"h3\",\"test3\",10,0,1,22,-1.1,1.1);`\n", "but note that this can change the displayed axis labels (requiring SetNdivisions\n", "to readjust).\n", "\n", "SetLabelOffset changes the (perpendicular) distance to the axis. The label\n", "position along the axis cannot be changed\n", "\n", "\n", "\n", "**Author:** Rene Brun \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:38 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "e6fb1722", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:13.267279Z", "iopub.status.busy": "2026-05-19T20:38:13.267164Z", "iopub.status.idle": "2026-05-19T20:38:13.721121Z", "shell.execute_reply": "2026-05-19T20:38:13.720494Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "TCanvas *c1 = new TCanvas(\"c1\",\"multipads\",900,700);\n", "gStyle->SetOptStat(0);\n", "c1->Divide(2,2,0,0);\n", "TH2F *h1 = new TH2F(\"h1\",\"test1\",10,0,1,20,0,20);\n", "TH2F *h2 = new TH2F(\"h2\",\"test2\",10,0,1,20,0,100);\n", "TH2F *h3 = new TH2F(\"h3\",\"test3\",10,0,1,20,-1,1);\n", "TH2F *h4 = new TH2F(\"h4\",\"test4\",10,0,1,20,0,1000);\n", "\n", "c1->cd(1);\n", "gPad->SetTickx(2);\n", "h1->Draw();\n", "\n", "c1->cd(2);\n", "gPad->SetTickx(2);\n", "gPad->SetTicky(2);\n", "h2->GetYaxis()->SetLabelOffset(0.01);\n", "h2->Draw();\n", "\n", "c1->cd(3);\n", "h3->Draw();\n", "\n", "c1->cd(4);\n", "gPad->SetTicky(2);\n", "h4->Draw();" ] }, { "cell_type": "markdown", "id": "693fed89", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "43e38f2a", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:13.722761Z", "iopub.status.busy": "2026-05-19T20:38:13.722628Z", "iopub.status.idle": "2026-05-19T20:38:13.935434Z", "shell.execute_reply": "2026-05-19T20:38:13.934835Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gROOT->GetListOfCanvases()->Draw()" ] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 5 }