After p1->Divide(4,1,0,0) change of margin in the canvas does not affect already created sub-pads.
If you configure bottom margin before calling TPad::Divide() method, new value will be used also for new sub-pads. Therefore you are see difference - normally default margin value is 0.1.
Oh… I just consider that p1->Divide(4,1,0,0) will set the margin to 0. As for your opion , does the SetBottomMargin(0.2) will covert the new value like 0.2 to Divide() function?
Margins in the pad defines space between pad boundaries and frame where histograms are drawn.
Then you call Divide, margin parameters have other meaning - it is space which remains empty when creating new sub-pads. Therefore p1->SetBottomMargin(0.2) does not affect position and size of subpads, but rather affects drawing of histograms in these subpads later.