Cannot set Y axis to log scale

I have been using the same code to generate plots for months. As of 7/5/16, it still worked. Starting 7/6/16, I started getting “Cannot set Y axis to log scale” and my histogram doesn’t get drawn. If I remove the line pad1->SetLogy();from the generated .C file, all is well (except of course that it’s not in log scale).

I have not changed anything from 7/5/16 to 7/6/16 that should have caused this. All I’ve been doing is messing with the parameters of a hypatia function for a fit.

2 Likes

Hi,

Well, that’s likely it. The pad will refuse to switch to log if it needs to paint a zero or negative value.

Cheers, Axel

The fact negative log axis cannot be drawn with ROOT (and with some other system too) is not new and that should not depend on the ROOT version you are using. I am curious to see which histogram (macro) produces a such error … can you post a small reproducer here ?

Found the problem–I had been setting the minimum to 0. If I set the minimum to 1 instead, it works fine. This is true even if some of the values plotted are 0.

Thanks.

May i ask you where you set the minimum to 1? Cos i have a similar problem with a logy scale but all my values are positives.

Hi,
two way or

hist->SetMinimum(1);

or

hist->GetYaxis()->SetRangeUser(1,whatever);

Cheers,
Stefano

Thank you, i finally managed to draw my logscale