# Divide canvas

salut
I would like to get a divided canvas (4 parts). I know how to do c1->Divide()… There is just the problem, that I want the plots side by side, without any space in between… I attached the plot how it looks up to now…
thanks for help
florian

Hi Florian,

Cheers, Bertrand.

thanks this is a very good link, but I don’t understand how to set a special distance… with Divide(1,2,0,0) there is no distance, what is with a distance of a few mm?
best regards
florian

Hi Florian,

Cheers,
Bertrand.

sorry but i don’t get it… I used different values for the xmargin and if I use a vale > 0 I have a big distance, if I use 0 I have no distance…

xmargin is the space along x between pads in percent of canvas.
ymargin is the space along y between pads in percent of canvas.

I can set the value to 0.000000001 and the value will not decrease. Were is my mistake?
florian

I have no problem playing with this…

I attached the commands I use, but only for one graph (forum.txt)… all commands are repeated 4 times for each graph, and the values used for the graphs are also excluded…
I attached also the hole root file, but this is dirty (particle-yields4.C)…
Thanks for help
florian
particle-yields4.C (10.4 KB)
forum.txt (1.27 KB)

Florian,
Please specify the x AND y margin values, i.e: `c1->Divide(1,4,0.02, 0.01);`
Cheers,
Bertrand.

I know… and I did it… but it doesn’t help… sorry if in the posted example I used only one value 0f 0.0002 this was just an example… I used many possibilities and it is not working…
best regards
florian

Then try to play also with top/bottom margins:

[code] c1->Divide(1, 4, 0.01, 0.01);

c1_1->cd();
c1_1->SetGridy();
c1_1->SetTopMargin(0.);
c1_1->SetBottomMargin(0.);
// and the same with other pads
[…][/code]Bertrand.

this is working thanks a lot…

Hi,
I am trying to append 3 TGraphs. But always the bottom one shows fonts with a bigger police or bolder, see attached figure.
I tried all I can to force the police size. I also checked with the “editor” and the sizes are the same 0.06 etc!
Thank you
Filipe

Here I copy a minimalist code showing the problem 3 times exactly the same histo:

void Nice2D(TH2F *MyHisto,
Double_t SizeLabel,
Double_t SizeTitle,
Int_t TFONT,
Int_t NDIV,
Double_t OffsetTitleX,
Double_t OffsetTitleY,
TString NameTitle,
TString NameXTitle,
TString NameYTitle)
{
MyHisto->SetTitle(NameTitle);
MyHisto->SetLabelSize(SizeLabel,“X”);
MyHisto->SetLabelSize(SizeLabel,“Y”);
MyHisto->SetLabelFont(TFONT,“X”);
MyHisto->SetLabelFont(TFONT,“Y”);
MyHisto->SetTitleSize(SizeTitle,“X”);
MyHisto->SetTitleSize(SizeTitle,“Y”);
MyHisto->SetNdivisions(NDIV,“X”);
MyHisto->SetNdivisions(NDIV,“Y”);
MyHisto->SetTitleOffset(OffsetTitleX,“X”);
MyHisto->SetTitleOffset(OffsetTitleY,“Y”);
MyHisto->GetXaxis()->CenterTitle(kTRUE);
MyHisto->GetYaxis()->CenterTitle(kTRUE);
MyHisto->SetXTitle(NameXTitle);
MyHisto->SetYTitle(NameYTitle);
}

int Bug(){

``````TH2F *histo=new TH2F("histo","",10, 0, 70, 10, -0.22, 0.22);
Nice2D(histo, 0.06, 0.07, 42, 505, 0.95, 0.7, "test", "testX", "testY");

TCanvas *c_super = new TCanvas("c_super","comparing modes",100,100,600,700);
c_super->cd();
//c_super->Divide(1,3,1e-17,1e-17);

for(int m=1; m< 4; m++){