I want to add 2 different plots in the same graph

I have two plots one is entries vs pT and another is entries vs sT. I want to add these plots in the same graph (one as a y axis and one as a y axis) as shown in screenshot.
1

can you please help me?

thanks.

Hi,
I am not really sure if I understood your problem correctly.
Try to have a look to TPad::Divide and the top part of the TCanvas page.

Maybe also this 2 tutorials can be helpful.

canvas1.c
canvas2.c

hey…
I couldn’t get it.
suppose I have a root file sphericity.root and inside this root file there are two plots eg spheri1 and spheri2. i want plot these plot in same canvas. then what should be the codes for those plots (including legends, title ).
can you please help me with the code?

Thanks.

Try to run:
rootls -l sphericity.root
or:
root -b -q -l sphericity.root -e 'gFile->ls();'

I want to know the root macro codes for two plots in a single canvas.


I want to add the legend and title for all plots. but it is showing in only 4th part of the canvas.

TLegend

yeah… I know how to put a legend but i don’t know how to set for all

You can add any object in a TLegend, any object in these 4 pads can go in. You can also create several legends if you need them. It depends on what you mean by “set for all”.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.