SetLogy in a pad of a canvas

Hi.

What I’m trying to do is plot the same histogram in one canvas on 2pads. One pad with a logarithmic scale and one without.

I have a canvas (eg c) and histogram (eg h)
c -> Divide (1,2) //canvas divided into 2parts
c -> cd(1) //select a canvas
c -> SetLogy() // SetLogy in current pad
h -> Draw()

why doesn’t this work?

I’ve also tried :
c -> Divide (1,2)
TVirtualPad* p1
p1= c-> cd(1)
p1 -> SetLogy
h -> Draw()
That doesn’t work either

n neither does:
c -> Divide (1,2)
c -> cd(1)
c -> GetSelectedPad() -> SetLogy()
h -> Draw()

Can somebody spot what I’m doing wrong? I’m pretty new to root, n I can’t understand why its being so difficult.

You should set the Log option in the subpad, not in the canvas, ie
instead of:

c -> Divide (1,2) //canvas divided into 2parts
c -> cd(1) //select a canvas
c -> SetLogy() // SetLogy in current pad
h -> Draw() [/code]

do

c -> Divide (1,2) //canvas divided into 2parts c -> cd(1) //select a canvas gPad-> SetLogy() // SetLogy in current pad h -> Draw()

Rene

1 Like