How to use different margins in the same canvas?

Hello, I define a canvas with 12 pads like this

/---------------\
| 1 | 2 | 3 | 4 |
|---|---|---|---|
| 5 | 6 | 7 | 8 |
|---|---|---|---|
| 9 |10 |11 |12 |
\---------------/

I would like to use different style to modify margins. So I would like to use

  • gStyle->SetPadLeftMargin(0.17) for pads 1, 5 and 9
  • gStyle->SetPadLeftMargin(0.01) for the others pads
    I want to plot TGraph in each pad.
    I tried to do the same thing that here but it does not seem to work.
TExec *ex1 = new TExec("ex1","gStyle->SetPadBottomMargin(0.01);");
TExec *ex2 = new TExec("ex2","gStyle->SetPadBottomMargin(0.17);");
....
c1->cd(1);
g1->Draw("AL*");
ex2->Draw();
g1->Draw("AL*same");
c1->cd(2);
g1->Draw("AL*");
ex1->Draw();
g1->Draw("AL*same");
...

Could you help me please?
Thanks.

Why don’t you use directly the individual pad attributes instead of global settings ?
root.cern.ch/root/html/TAttPad.h … LeftMargin

Yes, it is exactly what I want. I did not know this way. Thanks.