Unwanted subseconds displayed on time axis

For displaying a graph, I use a time representation on the x axis.

in Python:

    g.GetXaxis().SetTitle("date")
    g.GetXaxis().SetTimeDisplay(1)
    g.GetXaxis().SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}")

This used to give me nice lables in the following form:

16.12.13
11:02:03

Now I realized, that when I’m zooming in to the x axis, at a certain zoom level, I start getting labels like this:

16.12.13
11:02:03s05189

This behaviour is unwanted. I did not find any hint in the documention to avoid this.

Currently I’m using ROOT 5.34/13 (v5-34-13@v5-34-13, Dec 01 2013, 12:01:56 on win32). I did a update recently updating from 5.34/07, and I believe that I did not have this issue there. Unfortunately, I can’t go back easily to verify.

Thank you for your assistance,
Christian

That part of Root has not changed lately.

As said, I’m not really sure if this behaviour was there in 5.34/07 or not.

Anyway: Is there a possibility for never having subseconds shown? Or is “%S” always implying subseconds from a certain zoomlevel on?

can you provide a minimal macro reproducing this effect ?
I did not manage to reproduce it …

Sure, here we go:

[code]{
Double_t x[100], y[100];
Int_t n = 100;
for (Int_t i=0;i<n;i++) {
x[i] = i;
y[i] = i*0.1;
}
gr = new TGraph(n,x,y);
gr->Draw(“AP”);

gr->GetXaxis()->SetLabelSize(0.025);
gr->GetXaxis().SetLabelOffset(0.03);
gr->GetXaxis()->SetTitle(“date”);
gr->GetXaxis()->SetTimeDisplay(1);
gr->GetXaxis()->SetTimeFormat("#splitline{%d.%m.%y}{%H:%M:%S}");
}[/code]

Now zoom several times on the x axis to a very small intervall. At some zoomlevel, the format of the time will change (see attachments).

I want to highlight, that in this example, there is only one digit after the “s”. In my program, there are five digits. I don’t know why.




yes I see that zooming on a real small interval makes the “s” appear.
I will check

You need to go below the sec as you zoom otherwise you will have several tick with the same label.
for me that’s correct … the plot you sent is correct seems to me …

Well, I don’t believe this should be the intended behaviour.

When I change the time format to “#splitline{%d.%m.%y}{%H:%M}” in the example to omit the seconds, ROOT has not any problems at all to have several ticks with same label. Also then I can zoom in to maximum, without magically seconds or subseconds to appear.

And even if this behaviour for some reasons should be intended and is meant not to be influenced by SetTimeFormat: Shouldn’t the subseconds be printed out properly at least? In the attachment above you see, that if the subseconds are 0, the label is not “01:00:47s0”, as one might then expect, but “01:00:47s” without the trailing 0.

Also, in my real script, it’s not only one digit behind, but 5. I was not able to reproduce this with a simple script, but I attached an example picture. Apart from that, my script (written in Python) behaves exactly like the strip-down example above.


for me the simple exampleis fine. It makes sense to have subseconds when you zoom.
I do not see that 5 digits effect.