Extra offset on x-axis tick labels on re-labelling


I am bit stuck with this issue. I want to relabel the x-axis of the following plot:

I tried:

axish[1].GetXaxis().SetBinLabel(5,“75”); axish[1].GetXaxis().SetBinLabel(6,“90”); axish[1].GetXaxis().SetBinLabel(7,“105”);

However, all labels are having an offset

Does anyone know how I can re-label 5 as 75, 6 as 90, etc…

Thank you very much

The first argument of SetBinLabel is the bin number, not the value on the axis. So it seems that “5 to 6” is bin number 6 in your case, and so on, but you should know the binning of your histogram.

Thanks a lot for the reply! Even though “5 to 6” is bin number 5 or 6, my question is how should I label the bin edges. For instance, here, bin 6 is re-labeled as 90 (as written in the commands used in the question), but what I want is text “90” should be on the edge of the bin and not in the center of the bin.
i.e. text “5” should be replaced by say “x” and text “6” to be replaced by say “y”; and not “5 and 6” getting replaced by centered text “90” as seen in the second plot of the question.

Text labels are centered by definition. You can use ChangeLabel to do what you want. See an example here.

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