Graph with time Units

Hello .

I have txt file with some measurements. Like this
measurements.txt (15.0 KB)

First column is date. Second is time. Other columns are different measurements.

I need to create ROOT file with graphs like that

for each column of measurements.

Where X-axis is date-time axis and Y-axis is some measurement.

How I can do it?

Thank you

Here is a small example showing you how to read your file. You can complete it to retrieve the data you need. Then the time axis tutorials on the web will show you how to make a graph with time axis.

{
   FILE *f = fopen("measurements.txt","r");
   if (f) {
      printf("Could not open measurements.txt\n");
      return;
   }
   char line[200];
   Int_t i = -1;
   int d,m,y;
   while (fgets(line,200,f)) {
      sscanf(&line[0] ,"%d",&d);
      sscanf(&line[3] ,"%d",&m);
      sscanf(&line[6] ,"%d",&y);
      printf("%d %d %d\n",d,m,y);
   }
   fclose(f);
}

https://root.cern/doc/master/timeonaxis_8C.html
https://root.cern/doc/master/timeonaxis2_8C.html

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