Tick label

Hi,

Say I have a histogram from 0 to 250 with 5 bins. Then there will be 6 labels next to the larger ticks on the x-axis: 0, 50, 100, 150, 200, 250.

I would like to replace the last one with “inf”. I guess that there is some text object in memory that I could change an redraw. But how do I obtain that object?

Thanks,
Peter

You can make histogram with alphanumeric labels but I guess that will complicate the histogram filling.
The best is surely to just write a text. If you send me the histogram as a C macro or a ROOT file I can make an example for you

Let’s use this:

TH1F* h = new TH1F(“h”, “h”, 10, 0, 10);
h->Fill(7);

Thanks!
Peter

{
   TH1F *h = new TH1F("h","h",10,0,10);
   h->SetBinContent(8,1);
   h->Draw();

   TPaveText *pt = new TPaveText(9.741379,-0.05895128,10.33405,-0.006117593,"br");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetLineColor(0);
   text = pt->AddText("Inf");
   pt->Draw();

}

Hi,

ok, so basically you’re putting something on top of the number.

Do I conclude correctly that there is no object in memory that represents this number? If there was, I could fetch and replace it.

Best,
Peter

The object in memory is the axis.
Only if you use alphanumeric labels you have an object in memory for each label.