Logscale strange behavior

Hello,

I am trying to plot some 2D histograms, my code is like that:

c = TCanvas("c", "c")
c.cd()
sty = TStyle("sty","my style")
sty.SetOptStat(0)
sty.SetTitleX(0.35)
sty.cd()

hist.SetAxisRange(0.90,1.01,"Z")
xax = hist.GetXaxis()
yax = hist.GetYaxis()
xax.SetLimits(0,300000)
yax.SetLimits(0,20000)
yax.SetMaxDigits(3)
print "Drawing..."
gPad.SetLogx()
gPad.SetLogy()
hist.Draw("colz")

Now I get my x and y axes starting from ~10^4 and ~10^3 respectively instead of 0. Somebody knows why?

Cheers,
Jacopo

How much is log(0) ?

I mean, 10^3 is much higher than what it should be, I get my axes cut for low values

So Set reasonable Limits or do not SetLimits at all.

It does not seem to depend on limits. I always get the same
output

xax.SetLimits(1, 300000)
yax.SetLimits(1, 20000)

Again, it doesn’t work…

Log(x) when x <= 0 is not valid.
You should have the lower limits of your axis strictly positive.

I am trying with different lower limits but it seems not to
change anything

can you post an example we can run showing the problem ?

The histogram i am plotting is in a root file

You can send the root file containing the histogram ? if it is too big you can extract the histogram and put it in a new file using rootcp

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.