Jacopo
1
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
Jacopo
3
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.
Jacopo
5
It does not seem to depend on limits. I always get the same
output
xax.SetLimits(1, 300000)
yax.SetLimits(1, 20000)
couet
8
Log(x) when x <= 0 is not valid.
You should have the lower limits of your axis strictly positive.
Jacopo
9
I am trying with different lower limits but it seems not to
change anything
couet
10
can you post an example we can run showing the problem ?
Jacopo
11
The histogram i am plotting is in a root file
couet
12
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
system
Closed
13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.