Home | News | Documentation | Download

TMultigraph with timeaxies

Hi, rooters.

I have some problem with Multigraph with timeaxies building.

I have two sets of data :

double time1[52]; // time points in hours
double value1[52];

and

double time2[118]; // time points in hours
double value2[118];

with different starting points :

TDatime da(2020,06,26,13,00,00);
TDatime da2(2020,06,29,9,00,00);

So, I am able to create two graphs apart. By that way :

TGraph *gr = new TGraph(jjj,time,value);
gr->Draw("APL*");
gr->GetXaxis()->SetTimeDisplay(1);
gr->GetXaxis()->SetNdivisions(205);
gr->GetXaxis()->SetTimeOffset(da.Convert());

gr->GetXaxis()->SetTitle("Real time [Day-hour]");
gr->GetYaxis()->SetTitle("Average Count rate [Hertz]");  

But I can’t understand how to create TMultigraph with these sets of data.

Could you help me, please.

Check out the documentation. Try the first example they give - after filling the graphs, just create a TMultiGraph, Add the graphs to it and Draw the multigraph (not the graphs); you also can set the line colour, marker style, etc on each graph (not on the multigraph).

1 Like