# How to the decrease the number of Label of Draw(time:x)

**URL:** <https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177>\
**Category:** ROOT\
**Created:** [May 18, 2010, 4:56pm UTC](https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177 "2010-05-18T16:56:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wolfman](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/a8b319/32.png) [@Wolfman](https://root-forum.cern.ch/u/Wolfman)\
**Post date:** [May 18, 2010, 4:56pm UTC](https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177/1 "2010-05-18T16:56:09Z")

</div>

Hello,  
I want to read in Data of a Tree file, as usual with date and time columns. Like that:  
2010-04-29 15:20:49.335 0 1 2 3  
2010-04-29 15:21:09.735 0 0 0 0  
2010-04-29 15:21:30.135 0 0 2 0  
2010-04-29 15:21:50.535 0 0 0 0  
2010-04-29 15:22:10.935 0 0 0 0

I read in the Time/Data as Ch. like that:  
tree-\>ReadFile(“name.txt”,“year/C:time:l1/D:l2:l3:l4”);

Now I want to Draw something like:  
Draw(“time:l1\>\>h1”);

As I have a lot of 10.000 lines and even more there are always too much Labels drawn…  
I tried allready to change h1 with:  
SetNdivision or  
as a Time axis

And some other things, which I already found in the forum or the user guide. Nothing worked.  
At least I would have to decrease the number of labels or even better to include the days at the same axis. As this format of variables is quite usual, I maybe thought to be not the only one thinking about that…  
Thanks Wolfgang

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 19, 2010, 9:21am UTC](https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177/2 "2010-05-19T09:21:34Z")

</div>

If you read the dates as character strings, you will have one bin per date each of them labelled with a character string (a date). That’s the definition of an histogram with alpha numeric labels. There is no way to reduce the number of labels for such histograms: by definition all the bins _must_ be visible. What you want is a time axis. In that case you should convert the date into integers with TDatime and stored these numbers in your tree instead of the character string.  
More details here: [root.cern.ch/drupal/content/how- … time-units](http://root.cern.ch/drupal/content/how-create-axis-time-units)

---

<div class="post-metadata">

**Author:** ![Wolfman](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/a8b319/32.png) [@Wolfman](https://root-forum.cern.ch/u/Wolfman)\
**Post date:** [May 19, 2010, 10:20am UTC](https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177/3 "2010-05-19T10:20:56Z")

</div>

Thank you,  
I still have problems, I tried to convert the date with:  
TDatime T0(2010,04,29,15,20,49.335);  
int XO = T0.Convert();

So I’m not sure, if everything is alright with the seconds (they are no integers) and I didn’t find the command how to take exactly the data from one tree, to convert them and over all how to store them afterward in the same tree. I hope its not just a simply thing, but somehow I can’t see it…

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 19, 2010, 10:38am UTC](https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177/4 "2010-05-19T10:38:15Z")

</div>

As you can see here : [root.cern.ch/root/html/TDatime.html](http://root.cern.ch/root/html/TDatime.html)  
TDatime takes 6 integers.

---

<div class="post-metadata">

**Author:** ![Wolfman](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/a8b319/32.png) [@Wolfman](https://root-forum.cern.ch/u/Wolfman)\
**Post date:** [May 19, 2010, 10:42am UTC](https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177/5 "2010-05-19T10:42:51Z")

</div>

Yes, that’s the problem. Furthermore I can’t find anything about taking the data from the tree convert them and put them back…maybe I have to search somewhere else for that??

---

<div class="post-metadata">

**Author:** ![brun](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/b9e5f3/32.png) [@brun](https://root-forum.cern.ch/u/brun)\
**Post date:** [May 19, 2010, 10:59am UTC](https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177/6 "2010-05-19T10:59:53Z")

</div>

Instead of using TTree::ReadFile, read line by line and convert your date/time into more appropriate units.  
see example in $ROOTSYS/tutorials/tree/cernbuild.C

Rene

---

<div class="post-metadata">

**Author:** ![Wolfman](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/a8b319/32.png) [@Wolfman](https://root-forum.cern.ch/u/Wolfman)\
**Post date:** [May 25, 2010, 2:53pm UTC](https://root-forum.cern.ch/t/how-to-the-decrease-the-number-of-label-of-draw-time-x/10177/7 "2010-05-25T14:53:53Z")

</div>

I’m sorry but I didn’t manage it. I can’t see how to convert the time data to reach right time axis. If I separate seconds, minutes,… I won’t be able to draw something without containing a lot of data at the next time dimension (hours…). I thought, as many people are working with “timber” that there is a more convenient solution.
