Understand Axis Range


I would like to understand what the numbers SetAxisRange exactly mean? I know it is the minimum and maximum numbers to what the axis should have.

h1->SetAxisRange(0.5, 256.5);
h1->SetAxisRange(0., 256.);

I am working on someone else’s code and would like to know why they are using 0.5 more and not using the whole number (0, 256)? And in the second line why just have the decimal and not a number after it? How is it different than an integer?

Thanks, Dhruval

Please read tips for efficient and successful posting and posting code

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

Hi Dhruval,

The axis ranges are floating point values. It’s standard C++ to write 256. as a shorthand for 256.0.

It’s hard to tell why exactly the code uses these specific numbers. Perhaps the axis is logscale, so the axis should get close to zero but not zero. Perhaps the code should make sure that 256 is properly visible. But there are many other possibilities.


Hi @jblomer ,

Thanks for the explanation. It makes more sense!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.