{ "cells": [ { "cell_type": "markdown", "id": "b64bfce9", "metadata": {}, "source": [ "# gr106_exclusiongraph\n", "\n", "The shaded areas are obtained with a fill for the graph and controlled with `SetLineWidth`.\n", "`SetLineWidth` for exclusion graphs is explained in the [TGraphPainter documentation](https://root.cern/doc/master/classTGraphPainter.html#GrP2)\n", "\n", "As the graphs will be superposed on drawing, we add them to a [TMultiGraph](https://root.cern/doc/master/classTMultiGraph.html) and then draw this one.\n", "\n", "\n", "\n", "**Author:** Olivier Couet \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": "639fd780", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:19.749109Z", "iopub.status.busy": "2026-05-19T20:38:19.749000Z", "iopub.status.idle": "2026-05-19T20:38:20.194961Z", "shell.execute_reply": "2026-05-19T20:38:20.194363Z" } }, "outputs": [], "source": [ "TCanvas *c1 = new TCanvas(\"c1\",\"Exclusion graph examples\",200,10,600,400);\n", "c1->SetGrid();\n", "\n", "TMultiGraph *mg = new TMultiGraph();\n", "mg->SetTitle(\"Exclusion graphs\");\n", "\n", "const Int_t n = 35;\n", "Double_t xvalues1[n], xvalues2[n], xvalues3[n], yvalues1[n], yvalues2[n], yvalues3[n];\n", "for (Int_t i=0;iSetLineColor(2);\n", "gr1->SetLineWidth(1504);\n", "gr1->SetFillStyle(3005);\n", "\n", "TGraph *gr2 = new TGraph(n,xvalues2,yvalues2);\n", "gr2->SetLineColor(4);\n", "gr2->SetLineWidth(-2002);\n", "gr2->SetFillStyle(3004);\n", "gr2->SetFillColor(9);\n", "\n", "TGraph *gr3 = new TGraph(n,xvalues3,yvalues3);\n", "gr3->SetLineColor(5);\n", "gr3->SetLineWidth(-802);\n", "gr3->SetFillStyle(3002);\n", "gr3->SetFillColor(2);\n", "\n", "mg->Add(gr1);\n", "mg->Add(gr2);\n", "mg->Add(gr3);\n", "mg->Draw(\"AC\");\n", " \n", "return c1;" ] }, { "cell_type": "markdown", "id": "2ef77b2c", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 3, "id": "54aad324", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:20.410671Z", "iopub.status.busy": "2026-05-19T20:38:20.410535Z", "iopub.status.idle": "2026-05-19T20:38:20.622252Z", "shell.execute_reply": "2026-05-19T20:38:20.621636Z" } }, "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 }