21double XtoPad(
double x);
22double YtoPad(
double x);
30 C =
new TCanvas(
"C",
"canvas",1024,640);
31 C->SetFillStyle(4000);
44 CanvasPartition(C,Nx,Ny,lMargin,rMargin,bMargin,tMargin);
49 h =
new TH1F(
"histo",
"",100,-5.0,5.0);
50 h->FillRandom(
"gaus",10000);
51 h->GetXaxis()->SetTitle(
"x axis");
52 h->GetYaxis()->SetTitle(
"y axis");
56 for (
Int_t i = 0; i < Nx; i++) {
57 for (
Int_t j = 0; j < Ny; j++) {
108 text.SetTextAlign(31);
109 text.SetTextFont(43);
110 text.SetTextSize(10);
111 text.DrawTextNDC(XtoPad(0.9), YtoPad(0.8),
gPad->GetName());
127 Float_t vStep = (1.- bMargin - tMargin - (Ny-1) * vSpacing) / Ny;
130 Float_t hStep = (1.- lMargin - rMargin - (Nx-1) * hSpacing) / Nx;
132 Float_t vposd,vposu,vmard,vmaru,vfactor;
133 Float_t hposl,hposr,hmarl,hmarr,hfactor;
135 for (
Int_t i=0;i<Nx;i++) {
139 hposr = lMargin + hStep;
140 hfactor = hposr-hposl;
141 hmarl = lMargin / hfactor;
143 }
else if (i == Nx-1) {
144 hposl = hposr + hSpacing;
145 hposr = hposl + hStep + rMargin;
146 hfactor = hposr-hposl;
148 hmarr = rMargin / (hposr-hposl);
150 hposl = hposr + hSpacing;
151 hposr = hposl + hStep;
152 hfactor = hposr-hposl;
157 for (
Int_t j=0;j<Ny;j++) {
161 vposu = bMargin + vStep;
162 vfactor = vposu-vposd;
163 vmard = bMargin / vfactor;
165 }
else if (j == Ny-1) {
166 vposd = vposu + vSpacing;
167 vposu = vposd + vStep + tMargin;
168 vfactor = vposu-vposd;
170 vmaru = tMargin / (vposu-vposd);
172 vposd = vposu + vSpacing;
173 vposu = vposd + vStep;
174 vfactor = vposu-vposd;
182 auto pad = (
TPad*)
C->FindObject(
name.Data());
184 pad =
new TPad(
name.Data(),
"",hposl,vposd,hposr,vposu);
199double XtoPad(
double x)
202 gPad->GetPadPar(xl,yl,xu,yu);
204 double lm =
gPad->GetLeftMargin();
205 double rm =
gPad->GetRightMargin();
206 double fw = pw-pw*lm-pw*rm;
207 return (
x*fw+pw*lm)/pw;
210double YtoPad(
double y)
213 gPad->GetPadPar(xl,yl,xu,yu);
215 double tm =
gPad->GetTopMargin();
216 double bm =
gPad->GetBottomMargin();
217 double fh = ph-ph*bm-ph*tm;
218 return (
y*fh+bm*ph)/ph;
Option_t Option_t TPoint TPoint const char text
R__EXTERN TStyle * gStyle
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
virtual void SetTitleFont(Style_t font=62)
Set the title font.
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title.
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
void SetFrameBorderMode(Int_t mode=1)
void SetFrameFillStyle(Style_t styl=0)
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
void CenterTitle(Bool_t center=kTRUE)
Center axis title.
1-D histogram with a float per channel (see TH1 documentation)
virtual void SetMaximum(Double_t maximum=-1111)
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual void SetMinimum(Double_t minimum=-1111)
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
The most important graphics class in the ROOT system.
void SetBorderSize(Short_t bordersize) override
void SetFillStyle(Style_t fstyle) override
Override TAttFill::FillStyle for TPad because we want to handle style=0 as style 4000.
Double_t GetAbsWNDC() const override
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
void SetBorderMode(Short_t bordermode) override
Double_t GetAbsHNDC() const override
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Base class for several text objects.
constexpr Double_t C()
Velocity of light in .