Different size of divided canvas

Dear Forum,
I have problem about drawing divided canvas into different size. Part of my code is famillar as follows:

TCanvas* cc=new TCanvas();
cc->Divide(2,1);

How could I draw 1st part of divided canvas into 80% of original and 2nd part 20%?

Divide() makes equal size pads. That’s a quick way to define the canvas tiling with pads. For any other tiling you should create the pads yourself.

I solved it by follow:

{
   TCanvas *c = new TCanvas("c", "c", 800,600);
   c->Draw();
   TPad *p1 = new TPad("p1","p1",0.1,0.2,0.6,1.);
   p1->SetFillColor(kRed);
   p1->Draw();
   TPad *p2 = new TPad("p1","p1",0.7,0.2,0.9,1.);
   p2->SetFillColor(kBlue);
   p2->Draw();
}

1 Like