Logx for

Hello,

is there a way to show (part of) the first bin of a histogram whose x-axis starts from 0, when logarithmic x-axis is set?

I tried

{
TCanvas *c = new TCanvas();
TH1F *x = new TH1F("x", "x", 100, 0, 100);
x->Fill(0.01, 100);
x->Fill(1, 1);
x->Fill(10, 10);
x->Draw();
c->SetLogx();
x->GetXaxis()->SetRangeUser(0.001, 100);
}

and it does not work.

{
        TCanvas *c = new TCanvas();
        TH1F *x = new TH1F("x", "x", 100, 0, 100);
        x->Fill(0.01, 100);
        x->Fill(1, 1);
        x->Fill(10, 10);
        x->Draw();
        x->GetXaxis()->SetLimits(0.001, 100);
        c->SetLogx();
}

it doesn’t really work with variable bins:

{
        TCanvas *c = new TCanvas();
        Double_t edges[8] = { 0, 1, 2, 3, 4, 5, 7, 10 };
        TH1F *x = new TH1F("x", "x", 7, edges);
        x->Fill(0.01, 100);
        x->Fill(1, 1);
        x->Fill(10, 10);
        x->Draw();
        x->GetXaxis()->SetLimits(0.001, 100);
        c->SetLogx();
}

What is it supposed to do in that case ?

the same it does in the example you provided, i.e. keep on printing the first bin instead of skipping it

I am not sure that can work on non equidistant bins. I’ll ask.

The best is to do:

{
        TCanvas *c = new TCanvas();
        Double_t edges[8] = { 0.001, 1, 2, 3, 4, 5, 7, 10 };
        TH1F *x = new TH1F("x", "x", 7, edges);
        x->Fill(0.01, 100);
        x->Fill(1, 1);
        x->Fill(10, 10);
        x->Draw();
        c->SetLogx();
}

debug in progress here: sft.its.cern.ch/jira/browse/ROOT-7414

Now fixed