MultiGraph with different scales


I have two sets of data points in a multigraph which I fit with sine functions. Now, since I’m only interested in the phase difference I would like to move the upper graph down and rescale it on a second y-axis so that boths graphs have the same size and look nice in the plot.
I tried to use the “Superimposing histograms with different scales” example, but it didn’t work…

Thanks for help,
phases.C (713 Bytes)

I am not sure to understand your question.
Why don’t you simply replace

y1[i1] = 0.7*TMath::Sin(x1[i1]-3.5)+2; by

y1[i1] = 0.7*TMath::Sin(x1[i1]-3.5)+0; // or any other offset

Sorry, that I did not express myself clear enough… :unamused:

The attachment showed only the FIT FUNCTIONS I received from a data fit.

I do not wish to manipulate the fit functions for then I can’t display the correct fit parameters in the plot. I simply want to do some graphical cosmetics for a better comparison of the phase difference.

Actually, the two graphs have different y-axis parameters - so I need two axises.

I can even create an additional axis with the help of the “superimposing histograms” example, but that doesn’t make the upper graph move down and it doesn’t make the both graphs rescale to the whole size of the pad.

I now attach the original code and the data file.

Thanks - Greg
twosine.rar (1.39 KB)

The Multigraph purpose is to draw several graphs in the same coordinates system, the minimum and maximum values on each axis being computed in a way allowing to see all the graphs. That’s exactly what you DO NOT want to do. In you case your want to change the coordinates system of one of the graphs to be able to compare it with an other. You should make two separated graphs and plot them on top of each others using the transparent pad technique shown in $ROOTSYS/tutorials/transpad.C


the “transpad.C” was very helpful.

there’s only one bug left:
root can’t find the fit stats of graph 2 in the transparent pad2 and calls it “illegal pointer”. this problem does neither occur in transpad.C nor in pad1 with the fit stats of graph 1. any thoughts on that?

attached is the latest version of everything.
sinus.rar (1.79 KB)



instead of: