ROOT Version: 6.17/01
Compiler: gcc version 8.3.1 20190223
I have a 1-Dimensional histogram, say h1 with bins going from 0 to 4000. The X-axis tick-mark labels are
in the interval of 1000 i.e. 0,1000,2000,3000,4000
Now, I rebin X-Axis using
After this operation the X-axis tick-mark labels are still the same i.e. 0,1000,2000,3000,4000
I want these to change to 0,100,200,300,400 since the calibration of the axis is also changed now. I am not able to get this behaviour.
I tried to search for the answer on the ROOT Forum but the search did led to to relevant post. Also, I am sorry, if this sounds a very simple question.
Thank you very much! It is working!
But isn’t there a simple way to achieve it? We need this functionality quite frequently with different scaling factors. This means - I have to edit the macro everytime before using it. Isn’t it?
What I was doing was following:
root  .L ScaleAxes.cxx++
root  .L ../can2root_utils_cc.so //"can2root_utils.cc stores several macros
root  loadF("CtrdShftAna.root");
root  td662Vs377_278_bgsub->RebinX(10);
root  ScaleXaxis(td662Vs377_278_bgsub, ScaleX);
root  td662Vs377_278_bgsub->Draw();
root  td662Vs377_278_bgsub->ResetStats();
With the above I achieve what I wanted to by changing
v = 10 * x + 100; to
v = 0.1 * x + 100; in the original macro in
Double_t ScaleX(Double_t x) function.
It would have been great to use a scaling factor at root  instead of using ScaleX.
I hope I was using it as it is intended.
With best regards,
If the x-axis is a “fix bin size” one then this should be enough:
Perfect! This is what I was looking for. Thank you once again.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.