Hi everyone!
I am trying to have a histogram with variable bin width but I would like to print the axis with the same bin dimension.
E.g. my bin edges are 0.2, 0.3, 0.4, 0.5, 1 and I would like the 0.5-1 bin to have the same drawn size of the 0.2-0.3 bin. Is there a way to do that?
Thank you!
I am not completely sure what you mean by " same drawn size" … I did the following toy macro:
{
float bins[5] = {0.2, 0.3, 0.4, 0.5, 1 };
auto *h = new TH1F("h","h",4,bins);
h->Draw();
}
Which gives me an X axis labelled from 0.2 to 1. … which is correct.
Sorry, maybe I wasn’t clear enough. That method certainly works but the size of the last bin is 5 times the size of the other bins. I would like them to be graphically the same width.
That’s not how it will be represented . The last bin will graphically have a width 5 times larger than the 1st one.
One way might be to use alphanumeric labels … but then the histogram filling will be more tricky …
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.