SetLogx() gives me empty histogram

Hi,

I’m trying to draw a histogram in log x scale, so I set SetLogx() for my canvas. But this gives empty histogram.

linear x scale → always works with any option
log x scale → works well with “hist” or “bar” option. But with other options, it gives empty histogram even though the bin has its content and error. I set the x range not to contain zero, but it doesn’t fix my problem.
Is there anything that I’m missing?

Thanks


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.20/04
Platform: Not Provided
Compiler: Not Provided


Can you provide an example that can be run, showing the problem?

Below is the example. I wrote those lines in root command line.

TH1D *h = new TH1D("h","h",10,1,5);
for(int i=1; i<11; i++){
h->SetBinContent(i,i*5);
h->SetBinError(i,sqrt(i));
}
h->SetFillColor(kRed);
h->Draw();
// it works
h->Draw("hist");
// it works
h->Draw("e2");
// it works
c1 -> SetLogx();
h->Draw();
// it does not work
h->Draw("e2");
// it does not work
h->Draw("hist");
// it works

It works for me. If you close the canvas between Draw commands, the scale is reset to linear, but as long as you don’t close the canvas, it keeps the log scale, and the histogram is drawn correctly in log scale. Maybe try a more recent ROOT version.

Yes, I tried it again with ROOT Version: 6.22/06, and now it works. Thanks!