yes i have noticed and implemented your change but had the same results.
so my exact code is the following:
// creating the tree:
sprintf(treename,"Radon Data",200000);
sprintf(treetitle,"Tree of the Radon Data");
TTree *tree = (TTree*)outRf->Get(treename);
if (tree==NULL)
{
tree = new TTree(treename,treetitle);
tree->Branch("labviewtime", &labviewtime, "labviewtime/D");
tree->Branch("HumidityRel.", &data[0], "HumidityRel./D");
tree->Branch("AirPressure", &data[1], "AirPressure/D");
tree->Branch("Rn222", &data[2], "Rn222/D");
tree->Branch("Rn222error", &data[3], "Rn222error/D");
tree->Branch("Temperature", &data[4], "Temperature/D");
}
}
// i fill the Ttree named tree..
}
const int N=nlines-1;
double x[N],y[N],yerr[N];
for (int k=0;k<N;k++)
{x[N]=0;y[N]=0;yerr[N]=0;
}
TBranch *Tlabviewtime=tree->GetBranch("labviewtime");
TBranch *TRn222=tree->GetBranch("Rn222");
TBranch *TRn222error=tree->GetBranch("Rn222error");
Tlabviewtime->SetAddress(x);
TRn222->SetAddress(y);
TRn222error->SetAddress(yerr);
for (int k=0;k<N-1;k++)
{
x[k]=Tlabviewtime->GetEntry(k);
cout<<x[k]<<endl;
y[k]=TRn222->GetEntry(k);
yerr[k]=TRn222error->GetEntry(k);
}
TCanvas *c1 = new TCanvas("c1","Radon",200,10,700,500);
c1->SetFillColor(42);
c1->SetGrid();
c1->GetFrame()->SetFillColor(21);
c1->GetFrame()->SetBorderSize(12);
//const Int_t n = 10;
TGraphErrors *gr = new TGraphErrors(N,x,y,0,yerr);
gr->SetTitle("Radon");
//gr->SetMarkerColor(4);
//gr->SetMarkerStyle(21);
//gr->SetLineColor(4);
gr->Draw("LPA");
c1->Update();
hope this helps
cheers