THstack - SetMinimum - Logscale

Hi experts,

I used SetMinimum and SetMaximum in THStack, it works fine if i leave it as such. But if I wanted to have the yaxis lograthamic it throws error

Root > Error in THistPainter::PaintInit: Cannot set Y axis to log scale

excerpt of my macro

THStack *hs = new THStack(......);
hs->Add(h1);
hs->Add(h2);

c1->cd()
c1->cd()->SetLogy();
hs->Draw("hist");

I also tried with

gPad->Update();
gPad->setLogy();

I wonder is there a way I can set my minimum, maximum for theTHStack y axis and also have it log scale?

Thanks in advance.

can you provide small macro reproducing the problem ?

Hi,

I have attached my macro. Below is the error message.

[code]root [0]
Processing plotter_stack.Cā€¦
Error in THistPainter::PaintInit: Cannot set Y axis to log scale

*** Break *** segmentation violation
[/code]
plotter_stack.C (1.22 KB)

Your macro is not working as it is. I get:

root [0] .x plotter_stack.C 
Error in <TFile::TFile>: file RootFiles/A1/hist-data-output.root does not exist
Error in <TFile::TFile>: file RootFiles/A2/hist-data-output.root does not exist
Error in <TFile::TFile>: file RootFiles/A3/hist-data-output.root does not exist

Nevermind, I see that you set the minimum to 0. That can be the problem because Log(0) is undefined.
try a small value instead. Like 0.001

1 Like

Ah! I thought you just wanted to look at the macro! Sorry about that. Anyway, your suggestion worked. :slight_smile:
Thanks a lot.