ChangeLabel method does not work properly

In case of logaritmic axis the method ChangeLabel which is supposed to change style or remove particular axis label is not able to work for labels of type [2-9] *10^n

See the following code:

    TCanvas *can = new TCanvas("can");
    TH1 * h = gPad->DrawFrame(0.8, 0, 1113, 6);

    h->GetXaxis()->ChangeLabel(1,-1, 0);
    h->GetXaxis()->ChangeLabel(2,-1, 0);
    h->GetXaxis()->ChangeLabel(3,-1, 0);

Which removes only 1, 10 and 100 but no others.

In the first version of ChangeLabel it was not implement for log axis. Since le=the last release it is. I used the following example to test it:

   TH1F * h = new TH1F("h","h", 200,-10, +10);
   h->FillRandom("gaus", 10000);


which gives me:

I know it works for 1,10, 100, 1000, …
The issue is that it does not work for 2, 3, 4 … in case of log-axis

It means it is not implemented properly for axis with SetMoreLogLabels() switched on.

yes, it works only for the main tick marks,

OK, thanks,
for me, it would be nice to have the possibility to extract the actual axis layout. It means the array of used labels and the ticks positions. And then be able to call ChangeLabel for every label.

There are two reasons:

  1. In the ratio-like plots the axis labels of axes from diffrent frames often overlaps and one have no posibility to resolve it.
    There is an new class for ratio plot, but in real word the frames layout is often more comples than just upper plot and the ratio plot in the bottom.
  2. In the log-axis with more-log labels the numbers often overlaps which does not look good. For example, in plot which we have is the log axis from 84 to 4000 and the labels “90” and “100” are overlapping a lot. With the current ChangeLabel method I am unable to remove “90” and keep “100”.

Thanks for your feed back. I’ll look again at it. At a first glance it was not a straight forward change.

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