Dear ROOT team,
I would like to use a logarithmic x scale for my histograms. However, I observe that this works only for histograms starting at 0 or 1, but not at larger numbers. When I run the code below I do not get any histogram drawn, except if I set the lowest bin edge of the histogram to 0.
Is there any solution to this problem?
Please find below a minimal example:
import array, ROOT
ROOT.gROOT.SetBatch()
nbinsx = 3
xbins = array.array("d",[7,50,100,1000])
h = ROOT.TH1F("data","",nbinsx,xbins)
h.SetBinContent(1,20)
h.SetBinContent(2,50)
h.SetBinContent(3,30)
canvas = ROOT.TCanvas( "canvas", "canvas" )
pad = ROOT.TPad("pad","pad",0.0,0.0,1.0,1.0)
pad.Draw()
pad.SetLogx(1)
pad.cd()
hTemp = h.Clone()
hTemp.Draw("AXIS")
h.Draw("same,ep")
canvas.SaveAs("test.pdf")
In fact, it does not matter for the problem if I use hTemp or not, the behaviour is the same. However, I would like to have a template histogram which I can use to set the ranges.
Thank you very much in advance!
Cheers,
Alexander
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided