Creating a log and linear plot in the same canvas pad using THStack

Hi all,

I am currently having trouble with the issue of being able to display a log and a linear plot in the same pad using THStack. I know that one of the pads should be transparent, however, I am having difficulty in making one of the histograms remain in log form. Also, I do not know where the axes went as well.

This has definitely been a learning curve but any help is appreciated. Thank you.

8.7_ll_gate_bgs.C (4.8 KB)

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Dear @Xavier_James ,
A similar question has already been replied at How to plot with a linear and log scale on two different axes on same plot? (btw, you are not looking for THStack in your case)


Thank you! I will make sure to check there now.

Previously, I did try to implement from the forum link you had sent. Unfortunately, I am not able to get the similar results.

This means you tried Draw("SAME X+ Y+") etc.? (and without using THStack)

Yes. And I have tried the same example script without using THStack. Here is what I had attempted in my script similar to the other post. In lines 119-128.

There were some errors for using TPad itself and
8.7_ll_gate_bgs.C (5.5 KB)
C:147:11: error: no member named ‘SetLogy’ in ‘TH1D’

And using gPad on just one of the histograms when plotting together on the canvas does not work. I apologize trying my best to understand.

From using the updated code.

8.7_ll_gate_bgs.C (5.4 KB)