Time-axis and vertical labels + alignement histogram points

Dear ROOT-experts.

I am struggling with a couple of issues when using the time-axis defined through

 this_axis.SetTimeFormat("#splitline{%y-%m-%d}{%H:%M:%S}%F1970-01-01 00:00:00")

then the x-axis of the histogram is filled using an array of TTimeStamp objects.

Question 1:
I have tried rotating the axis-labels using


but keep getting:

Is there some restriction with the labelsoption when using time-axis? It works when I use a “normal” axis (not time).

Question 2:
I seem to have a bit of problems aligning my histogram-points to the actual x-value it is supposed to represent.

For instance: I know the x-value of a certain point is in time: 00:09:10 . However, it keeps showing up as around 00:20:00 on the time-axis. See attached plot.

It I do GetBinContent(bin) this gives me the seconds of the timestamp which I can convert back into time, and doing that I get back the time I expect which is 00:09:10. However, lining it up on the x-axis it looks more like at 00:20:00. See the point inbetween the two lines.

Is this due to some odd spacing-issue with the axis I wonder? The axis-bins are not evenly spaced. I know that other objects in the plots, for instance other points, lines etc do match up, it just that some points here and there do not.

How to find out what is going on?

Thanks a lot,

it worsk on alpha numerice labels only. You cannot split the time label using splitline (see example here root.cern.ch/drupal/content/how- … time-units)

The labels are optimized like for the numerical axis.

Thanks for your reply.

Splitline is not the problem, that works as expected. But when I try to display the x-axis labels vertically by using the LabelsOption(“v”) I get the message [code][TAxis::Sort:0: RuntimeWarning: Cannot sort. No labels
/code] and the labels stay horizontal.

About the x-axis-value I think I understand what is happening: The bin is rather wide for this point, and is placed in the middle of the bin naturally. So I guess I should have to use a TGraph instead if I want the points to match up perfectly. Sorry, yes, this is obviously as expected.


Yes that is what I meant, the option v is not implemented for this labels. if you need to avoid labels overlapping you should use splitline.

I see, so LabelsOption is not implemented for the time-axis. And I would have to play around with the splitting of the label to get a visually nice result.

Okay, thanks,