In your case you have 100 bins and 10 values, one every 10 bins …
Yes ok, change the width of bins, but the result it is same, becaus the increse it is 1, so if I take 10 bins, should draw 10 bars, instad draw again bars only for 1,2,4 and 7… why not for 3,5,6,8,9 and 10?? theoretically with the increse=1 should draw 1 bar for each bin no?
can you send what you have now ?
How can I add a image?
No … I mean the macro … I need the macro you have now …
Ah ok sorry… the macro is this:
{
TH1F *h1 = new TH1F(“h1”, “h1 title”, 10, 0, 10);
Int_t px=1;
Int_t py=1;
for (Int_t i = 0; i < 10; i++) {
px= px+i;
py=py+i;
h1->Fill(px,py);
}
h1->Draw(“HIST”)
}
{
TH1F *h1 = new TH1F("h1", "h1 title", 10, 0, 10);
Double_t px=1;
Double_t py=1;
for (Int_t i = 0; i < 10; i++) {
px = (Double_t)i;
py = py+(Double_t)i;
h1->Fill(px,py);
}
h1->Draw("HIST")
}
Perfet now work!!! thank you Couet
The last question is: when i draw a histogram with errors [ h1->Draw(“HISTOE1”) ] , how can i set the error? I mean the length of error bars
I have already the guide, and for set y error i have understood, for example:
{
TH1F *h1 = new TH1F(“h1”, “h1 title”, 10, 0, 10);
Double_t px=1;
Double_t py=1;
Double_t e=1;
for (Int_t i = 0; i < 10; i++) {
px = (Int_t)i;
py = (Int_t)i;
e = (Double_t)i/2;
h1->Fill(px,py);
h1->SetBinError(i , e);
}
h1->Draw(“HISTE1”)
}
I set ( Int_t bin, Double_t error ) and this is ok, but I don’t understand what mean:
SetBinError ( Int_t binx, Int_t biny, Double_t error )
Int_t biny identify the y bin, but what mean? the bin it set for x axis no?
And I don’t undestand how can I set the error also in x, because I can set only 1 error [ Double_t error ] and it is a error for y values.
That’s for 2D histograms. Yours is 1D…
aaa ok!!! and for set the error also in x, how can i do?
a global way is to use gStyle->SetErrorX()
I have to set SetBinError for y errors and
gStyle->SetErrorX() for x errors?
yes
Perfect!! Thank you a lot