Hi I am trying to plot a graph. I have got a data file with 2 colums of data (4000 value each) and i would like to plot a graph with the first colomun of data against the second. I am using as a starting line the program from the tutorials "example of a graph with errors bars" but i don't know how to include my set of data in the root program. In the tutorial, the values are directly typed in the program. Ex: Float_t y[n]={1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1}; I would like to know how to replace these values by calling my datafile. My code is the following; { // // gROOT->Reset(); ifstream in; in.open("data01.dat",ios::in); Float_t x0,x1; c1 = new TCanvas("c1"," Graph ",200,10,700,500); c1->SetFillColor(42); c1->SetGrid(); c1->GetFrame()->SetFillColor(21); c1->GetFrame()->SetBorderSize(12); Int_t n = 4000; /// /// Float_t y[n] = ? /// Float_t y[n] = ? gr = new TGraph(n,x,y); gr->SetMarkerColor(4); gr->SetMarkerStyle(21); gr->Draw("AP"); c1->Update(); } Cheers, Sam.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET