ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
zones.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphs
3 /// Example of script showing how to divide a canvas
4 /// into adjacent subpads + axis labels on the top and right side
5 /// of the pads.
6 ///
7 /// \macro_image
8 /// \macro_code
9 ///
10 /// \author Rene Brun
11 
12 void zones() {
13  TCanvas *c1 = new TCanvas("c1","multipads",900,700);
14  gStyle->SetOptStat(0);
15  c1->Divide(2,2,0,0);
16  TH2F *h1 = new TH2F("h1","test1",10,0,1,20,0,20);
17  TH2F *h2 = new TH2F("h2","test2",10,0,1,20,0,100);
18  TH2F *h3 = new TH2F("h3","test3",10,0,1,20,-1,1);
19  TH2F *h4 = new TH2F("h4","test4",10,0,1,20,0,1000);
20 
21  c1->cd(1);
22  gPad->SetTickx(2);
23  h1->Draw();
24 
25  c1->cd(2);
26  gPad->SetTickx(2);
27  gPad->SetTicky(2);
28  h2->GetYaxis()->SetLabelOffset(0.01);
29  h2->Draw();
30 
31  c1->cd(3);
32  h3->Draw();
33 
34  c1->cd(4);
35  gPad->SetTicky(2);
36  h4->Draw();
37 }
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Definition: TCanvas.cxx:659
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels The distance is expressed in per cent of the pad width...
Definition: TAttAxis.cxx:176
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2878
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:256
TAxis * GetYaxis()
Definition: TH1.h:320
The Canvas class.
Definition: TCanvas.h:48
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
Definition: TPad.cxx:1073
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition: TStyle.cxx:1252
#define gPad
Definition: TVirtualPad.h:288