Dear @couet, @Wile_E_Coyote,
I have this following macro. I want to plot both with Y values per bin. One has bin width = 4.55, another one has 5. How do I make bin width 1 in both the cases? Thanks
FILE *f1,*f2;
double col1[40],col2[40],col3[40];
double col4[30],col5[30];
f1=fopen("data1.txt","r");
f2=fopen("data2.txt","r");
for (int i = 0; i < 40; ++i )
{
fscanf(f1,"%lf %lf %lf",&col1[i],&col2[i],&col3[i]);
}
for (int j = 0; j < 30; ++j )
{
fscanf(f2,"%lf %lf",&col4[j],&col5[j]);
}
auto hist0=new TH1D("hist0","",150,50,200);
for (int k=0; k<=40; k++) {
hist0->Fill(col1[k],col2[k]);
int bin = hist0->GetXaxis()->FindBin(col1[k]);
hist0->SetBinError(bin,col3[k]);
}
hist0->SetMarkerColor(1);
hist0->SetMarkerSize(1.0);
hist0->SetMarkerStyle(21);
hist0->Draw("E1");
hist0->GetXaxis()->SetRangeUser(50,200);
auto hist1=new TH1D("hist1","",150,50,200);
for (int j=0; j<=30; j++) {
hist1->Fill(col4[j],col5[j]);
}
hist1->SetMarkerColor(2);
hist1->SetMarkerSize(1.0);
hist1->SetMarkerStyle(21);
hist1->Draw("same");
fclose(f1);
fclose(f2);
__
ROOT Version: 5
__
data1.txt (664 Bytes) data2.txt (415 Bytes)