Can some x-axis value be replaced by some character in TGraphError?

Hello,

I am trying to replace some portion of x-axis float value by some text character in TGraphError. But not getting any clue how to do it. Can anyone help me?

Thanks & Regards,
Sayansome


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


https://root.cern/doc/master/gaxis3_8C.html

Thanks @dastudillo it is working now!

So here using ChangeLabel() member function we can replace only label value by some text. But if I am willing to add some text at some bin center, where there is no label, means in between two label, then how to do that?

Like, say my axis label is 0, 10, 20, 30, 40, 50. And by bin center is 5, 15, 25, 35, 45. So if I now use ChangeLabel() function then I can replace [0, 10, 20, 30, 40, 50] any of these values by text. But if I want to replace [5, 15, 25, 35, 45] these values by some text (because my data points lie here) then how to do that?

Thanks & Regards,
Sayan

Try SetBinLabel:
https://root.cern/doc/master/classTAxis.html#a076f6c6cc9358302d3d9487ec94fb665

Or just draw the text as TLatex at any position you want.

You can also increase the number of divisions:

graph->GetXaxis()->SetNdivisions(520);

Then the intermediate labels (ending with 5) will appear (increase the number of division until the do). Then you will be able to use the ChangeLabel technique.

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