Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
gr103_zones.py
2## \ingroup tutorial_graphs
3## \notebook
4## Example of script showing how to divide a canvas
5## into adjacent subpads + axis labels on the top and right side
6## of the pads. Original tutorial by Rene Brun.
7##
8## See the [Divide documentation](https://root.cern/doc/master/classTPad.html#a2714ddd7ba72d5def84edc1fbaea8658)
9##
10## Note that the last 2 arguments in
11## c1->Divide(2,2,0,0)
12## define 0 space between the pads. With this, the axis labels where the pads
13## touch may be cut, as in this tutorial. To avoid this, either add some spacing
14## between pads (instead of 0) or change the limits of the plot in the pad (histos
15## in this tutorial). E.g. h3 could be defined as
16## TH2F *h3 = new TH2F("h3","test3",10,0,1,22,-1.1,1.1);
17## but note that this can change the displayed axis labels (requiring SetNdivisions
18## to readjust).
19##
20## SetLabelOffset changes the (perpendicular) distance to the axis. The label
21## position along the axis cannot be changed
22## \macro_image
23## \macro_code
24## \author Alberto Ferro
25
26import ROOT
27
28c1 = ROOT.TCanvas("c1","multipads",900,700)
30
31c1.Divide(2,2,0,0)
32h1 = ROOT.TH2F("h1","test1",10,0,1,20,0,20)
33h2 = ROOT.TH2F("h2","test2",10,0,1,20,0,100)
34h3 = ROOT.TH2F("h3","test3",10,0,1,20,-1,1)
35h4 = ROOT.TH2F("h4","test4",10,0,1,20,0,1000)
36
37c1.cd(1)
39h1.Draw()
40c1.cd(2)
43h2.GetYaxis().SetLabelOffset(0.01)
44h2.Draw()
45c1.cd(3)
46h3.Draw()
47c1.cd(4)
49h4.Draw()
50
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.