Rotate all labels of a histogram

ROOT Version: 6.18/04
Platform: Ubuntu 18.04
Compiler: gcc 7.5.0 (Ubuntu 7.5.0-3)

Dear co-rooters,

I’m trying to rotate the labels on a histogram.
I’m aware of the TGaxis::ChangeLabel() but I have to go and change the labels separately which isn’t handy if there are many histograms.

I’ve noticed the TGaxis::Rotate() function which I guess does what I want but I’m not sure on how to use it; the code also doesn’t help

Any idea on that?

Thanks in advance!

The help says:
Internal method to rotate axis coordinates.

That’s not what what you are looking for. Can you provide an example showing what you want to do ?

I’d like to rotate all the label in a time axis in a similar way it’s done bellow for label #3.

I can always go through each label and do it, but I want to do it in multiple histograms that don’t have the same number of labels so I was wondering if there’s a global way to do it.

On normal numeric labels there is no global way to do it.

The histograms I want to rotate the labels of, have time axis.
Are these considered numeric?

Thanks in advance!

Yes they are. Note with time axis you can change the format of the labels to draw them on two lines if they are too long (#splitLine) .

I already do that but it’s not enough!
I’ll try to find a way to rotate them individually.
Is there at least a way to return the number of labels drawn?


   Int_t divyo = 0;
   Double_t y1o  = 0.;
   Double_t y2o = 0.;
   Double_t bwy = 0;

   for (i = 0; i<=divyo; i++) {
     // loop on all labels.

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