Hi rooters,
i'm trying to create a graph (with bar errors) using TGraphErrors,
reading the data from an ASCII file. It succesfully creates the graph
but when i try to zoom or on the X or on the Y axis, the lowest limit
remains blocked on the minimum. How is it possible?
void leggi()
{
TCanvas *c1= new TCanvas("c1","c1",200,10,700,500);
int nlines=0,n=0;
FILE *file;
file=fopen("xs.dat","r");
if(file==NULL)
{
cout << "Errore apertura file!" << endl;
}
char riga[10000];
float energy_,xs_,xserr_;
float energy[10000],xs[10000],xserr[10000];
while(fscanf(file,"\n%[^\n]",riga)>EOF)
{
sscanf(riga, "%f %f %f", &energy_,&xs_,&xserr_);
energy[n]=energy_;
xs[n]=xs_;
xserr[n]=xserr_;
nlines++;
n++;
}
TH2F *hpx = new TH2F("hpx","Sezione d'urto ^{245}Cm",nlines,0.01,5000000,1000,0.01,10000.);
hpx->SetStats(kFALSE);
hpx->Draw();
hpx->GetXaxis()->CenterTitle();
hpx->GetXaxis()->SetTitle("E_{n} (eV)");
hpx->GetYaxis()->CenterTitle();
hpx->GetYaxis()->SetTitle("#sigma (barn)");
TGraphErrors *gr = new TGraphErrors(nlines,energy,xs,0,xserr);
gPad->SetLogy(kTRUE);
gPad->SetLogx(kTRUE);
gPad->Modified();
gPad->Update();
gr->SetMarkerStyle(21);
gr->SetMarkerSize(0.5);
gr->SetMarkerColor(4);
gr->Draw("LP");
c1->SetGrid(kTRUE);
Many thanks in advance,
MC
Received on Fri Apr 28 2006 - 17:45:45 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET