Draw two graphs on one canvas with different Y scales


I have two data files and macro. And I need to draw two graphs on one canvas with different Y scales. I have read specific topic in ROOT manual, but unfortunately it hasn’t helped me.

Can you help me please to solve this problem.

Thank you.
comp.C (1006 Bytes)

Note: the attached macro assumes that both graphs have (almost) the same x-axis range.
comp.cxx (1.65 KB)

1 Like

Dear Pepe Le Pew,

Thank you very much for your help.

Best regards.

Note: the attached macro draws graphs with different x- and y- axes ranges.
comp.cxx (2.1 KB)
pkppontsprod7.txt (19 Bytes)
ptotprod7.txt (30 Bytes)

There is some problem. I have two data files. And I use first script. The range of X coordinate for the Red curve doesn’t coincide with the range of X coordinate for the Black curve. Any changes in Range for xmin and xmax haven’t led to desired result.

Thank you.
pkpprod11.txt (741 Bytes)
ptotprod11.txt (840 Bytes)
compprod11withoutmagnetcorr.pdf (17.5 KB)

comp.cxx (2.77 KB)

Just for completeness of this thread, see also: “Superimposing two TGraphs with different ranges”