2 TGraph and 2 scales

Hi Rooters

Is there a way to draw 2 TGraph with 2 different scales on the same pad? There is an example (in the tutorials) on how to do this with 2 histograms, but I can’t figure out a way of doing this with 2 TGraph. The main problem comes from a “Scale” method that would multiply one TGrah with a constant value.

I could of course get the “y” vector values and multiply each element by a constant. But this seems complicated.

I am using ROOT 5.26 on a linux box.

Thanks

You should use the same method shown in the example for histograms.
The idea is to draw first one graph in a pad (p1), then you draw a transparent pad (p2) on top of it in which you draw the 2nd graph. You may use the X+ and Y+ options to draw the axis on the other side of the pad.

Thanks!

I tried it, it works! I just needed to also set the style to the TFrame to be transparent.