Logo ROOT  
Reference Guide
zones.C
Go to the documentation of this file.
1/// \file
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.
7///
8/// \macro_image
9/// \macro_code
10///
11/// \author Rene Brun
12
13void zones() {
14 TCanvas *c1 = new TCanvas("c1","multipads",900,700);
16 c1->Divide(2,2,0,0);
17 TH2F *h1 = new TH2F("h1","test1",10,0,1,20,0,20);
18 TH2F *h2 = new TH2F("h2","test2",10,0,1,20,0,100);
19 TH2F *h3 = new TH2F("h3","test3",10,0,1,20,-1,1);
20 TH2F *h4 = new TH2F("h4","test4",10,0,1,20,0,1000);
21
22 c1->cd(1);
23 gPad->SetTickx(2);
24 h1->Draw();
25
26 c1->cd(2);
27 gPad->SetTickx(2);
28 gPad->SetTicky(2);
29 h2->GetYaxis()->SetLabelOffset(0.01);
30 h2->Draw();
31
32 c1->cd(3);
33 h3->Draw();
34
35 c1->cd(4);
36 gPad->SetTicky(2);
37 h4->Draw();
38}
R__EXTERN TStyle * gStyle
Definition: TStyle.h:414
#define gPad
Definition: TVirtualPad.h:302
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
Definition: TAttAxis.cxx:191
The Canvas class.
Definition: TCanvas.h:23
TAxis * GetYaxis()
Definition: TH1.h:323
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition: TH1.cxx:3060
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:257
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:1589
return c1
Definition: legend1.C:41
TH1F * h1
Definition: legend1.C:5
Definition: zones.py:1