Equal pad size in TCanvas with one common axis

Hi,
I would like to have four graphs touching each other in 4 pads (so canvas->Divide(4,1,0,0) ). Problem is I would like them to have all equal size. But if you want to set the title on the one on the right you have to do pad1->SetLeftMargin(.2) to get the title in. But then the frame in this particular pad one becomes smaller. Also the frame line on the far left (pad number 4) is hidden. I would have expected something like setting the border on the whole canvas before dividing but seems I cannot do that.
I attach two screenshots to illustrate better the problem.
Also I would like to have one common title for the x-axes instead of 4 identical.
Any ideas on how to solve those issues?
Thanks very much,
Sebastien Murphy





ok thanks. After a bit of playing around the function provided in $ROOTSYS/tutorials/graphics/canvas2.C worked. Anybody has ideas on how to set only one x-title centred at the bottom?

set all the X titles to blank except the central one.

thanks yes this would be an obvious solution if you had 5 graphs but I have 4 (see previous pictures)

you can do some approximative approach by setting only le 2nd pad title and align it to the right…
or a precise one by setting all the titles to blank and draw a centered TLatex yourself.

ok thanks almost there I think. In the end like you suggested I simply set the beginning of the title for number 2 and the end for number 3 (not the most elegant but ok). TLatex was not printing anything.
Last question how do you flush the x-title of number 3 to the left to make it look appear as one? Can’t find something like axis->SetTitleXPosition(0).
Thanks,
Sebastien


Axis title are either in the middle of the axis or at the end… not on the left … sorry …

ok too bad…

Hi everyone,

I am trying to make six pads with six histograms in them and want one common axis and common label. I could make three together and want three more just below them, but as I am dividing the canvas or pad, its not working at all. Please guide me about how to do it…
I am attaching my code and a screenshot of what i have made.
Thanks a lot…dataplotoneDD2.C (8.6 KB) unnamed2.pdf (17.3 KB) .

I cannot run your macro. You did not post the data files.

Hi,

My datafiles are not getting uploaded due to large size. I have made a tarfile and tried it via just paste it website, hope it works.
Please find my data files from the link- https://justpaste.it/3hvgd, https://justpaste.it/edit/29731517/25f5f92a3ae30495

Thank you.

no… this wen site does not allow to download

how should I attach my data files ?

May be you can just make a fake macro without data (empty histograms) showing what you want to do.

Hi,
I have attached the files with very less data and code again.
It is giving me three pads and I want total six, three more just below each of them.
Please find the tar file with the code and data files.

Thank you.

datafiles.tar.gz (9.0 KB)

Ok I see now. If you do not want t use Divide you can try to copy what is done in this example:
https://root.cern/doc/master/canvas2_8C.html

Isn’t there a simpler code to make 6 pads, the way I made 3 in my code ?
This example seems a bit difficult to understand…

In that example just do:

 const Int_t Nx = 3;
 const Int_t Ny = 2;

yes, its working, how do I enter the data of my histograms in each of the six pads ?
I have to make three different histograms in each pad and edit each pad by adding different text to it…

I have added the histograms to this code, where should I draw them to see on the respective pads ?multipad.C (10.4 KB)