How to set Y axis in hstack?

Hi,
I tried

yAxis = hstack.GetYaxis()
yAxis.SetTitleOffset(1)

but it shows :

Traceback (most recent call last):
  File "plot3.py", line 86, in <module>
    yAxis.SetTitleOffset(1)
ReferenceError: attempt to access a null-pointer

And it works with:

yAxis = h1.GetYaxis()
yAxis.SetTitleOffset(1)

The only difference is h1 is a TH1F, and hstack is

hstack = ROOT.THStack()
hstack.Add(h1)
hstack.Add(h2)

Jen

Draw the stack before trying to get its axis.

And add gPad->Update(); gPad->Modified(); after having drawn the stack. This will force the axis creation. Axis are created at drawing time only.