GetXaxis()->SetTimeDisplay

Hi all,
I’ve a problem. Could you help me?
I’m working with this code:

[code]#include

void grafico2D()
{

ifstream file(“Data_AE.txt”);
double x, y;
TGraph *plot = new TGraph();
int ipoint(0);

while (!file.eof()) {
file >> x;
if (file.eof())
break;
file >> y;

 plot->SetPoint(ipoint,x,y);
 ipoint++;

}

file.close();

TDatime da(2013,03,21,12,00,00);
gStyle->SetTimeOffset(da.Convert());

plot->SetMarkerStyle(20);
plot->SetMarkerSize(1);

plot->GetXaxis()->SetTitle(“Time”);
plot->GetXaxis()->SetTimeDisplay(1);
plot->GetXaxis()->SetTimeFormat("%d/%m/%y");

plot->GetYaxis()->SetTitle(“Volts”);

plot->Draw(“Al”);

}
[/code]

On the Graph, I always have the same value on the X axis.
How can I increase the time (Xaxis) of 1 day (from 21-03-2013 to 27-01-2015)?
Thank you in advance.

Data_AE.txt is missing.

Excuse me,
Data_AE.txt (21 KB)

Ok I can run it now

I do not understand that: from 21-03-2013 to 27-01-2015 is not “one day” ?

Ok, I would like to see on the Xaxis, values ranging from 21/03/2013 to 27/01/2015
(eg. 21/03/13 15/05/13 23/07/13 … 10/10/14 12/12/14 20/01/15)

Thanks

Yes but it looks like the data you have in your file along X range inside less than a day. What is exactly the meaning of the X value inside your file ?
They should be time as the last example shown here:
root.cern.ch/how/how-create-axis-time-units

The X values are the time expressed in Julian Day, a value every 30 seconds.
I had already seen the link, but my problem remains.

it does not seems to be the format TDatime returns.

I modified the Data_AE.txt.
I expressed the X axis in terms of seconds.
It works well, thank you very much.

Good :slight_smile: