Resize graphs in pads

Hi

I am trying to plot 5 graphs on a pad devided into five. The pad is drawn on an embedded canvas.

GraphPad=new TPad("GraphPad","",0.0,0.05,1,1);
	GraphPad->Divide(1,5);
	GraphPad->Draw();
	GraphPad->SetFillStyle(4000);
	TAxis *a;
	for(int i=0;i<5;i=i+1)
	{
		FScan[i] = new TGraph("C:/root/macros/test.txt");
		a=FScan[i]->GetXaxis();
		a->SetTicks("-");
		a->SetLabelOffset(-0.1);
		a=FScan[i]->GetYaxis();
		a->SetTicks("+");
		a->SetTickLength(0.01);
		a->SetLabelOffset(-0.01);
		GraphPad->cd(i+1);
		FScan[i]->SetTitle("");
		
		FScan[i]->GetXaxis()->SetLabelSize(0.08);
		FScan[i]->GetYaxis()->SetLabelSize(0.08);


		FScan[i]->GetXaxis()->SetLimits(30/5*i,30/5+i*30/5);
		FScan[i]->Draw();
	}

The ticks should be outside the graphs and the labels are shifted accordingly. Furthermore, I need no titles.
Since I don’t have any titles on top of my graphs I could use that space for vertically increasing my graphs within the pads. Is there a way I can do that? Actually, I can enlarge the graphs inside the pads with the mouse.
Another problem is the lable offset of the last pad. Since I move my labels down they are cut off in parts.
The system is win7 and root 5.34/32
Thanks for help.

Cheers,
delos


[url=https://root-forum.cern.ch/t/multipad-graphics/17883/3 graphics[/url]

Hi

Thanks for the link and the links within the links.
Though, these links deal with some many different things that I couldn’t find a solution to my problems. I tried to set border and margins of pads but still the labels of my lower plot are cut off.
What I didn’t find at all is how to stretch my graphs inside the pads. With the mouse I can adjust the size and position within the pads so it fits well. Isn’t there a way to do this in the script?

Thanks and regards,
delos

Try:
GraphPad->Divide(1, 5, 0.001, 0.001, 0); // (nx, ny, xmargin, ymargin, color)
and then after:
GraphPad->cd(i+1);
add something like (play with “left” and “bottom” settings):
gPad->SetMargin(0.02, 0.001, 0.04, 0.02); // (left, right, bottom, top)

Hi Coyote

Thanks, but the graphs inside the pads are still the same. I can increase them vertically with the mouse but I still didn’t find a way to give them a fixed size right from the beginning.

Below I attached a picture how I want my graphs to apear on the canvas or pads. The middle one is the one how it should look like. I resized it with the mouse.

Cheers,
delos


Hi there

I think I finally found the solution.
Somewhere in the code I put

gStyle->SetPadLeftMargin(0.01);
gStyle->SetPadRightMargin(0.01);

Could anyone confirm that this is a “clean” solution? The I can set the topic “solved”.

Cheers,
delos

I confirm

I better question is why my proposed changes did not work (i.e. “Divide” and “SetMargin” settings).

Hi Coyote

I actually don’t know. I put your suggestions basically everwhere in my code but nothing changed.
Maybe couet knows?

Cheers,
delos

I must admit I have not looked closely (busy with some other matters), and, as you seemed to have found a solution (looking fine for me) I did not investigate further…