[ROOT] TH1 histogram

From: Thomas Hadig (hadig@toots.physik.rwth-aachen.de)
Date: Sun Apr 16 2000 - 22:24:04 MEST


Dear Rooters,

what mistake do i make:

Running :

{
TCanvas *c1 = new TCanvas("data1","");
c1->SetLogx(1);
c1->Draw();

TH1F *h2 = new TH1F("","",1, 0.01, 1);
h2->SetMaximum(10);

Float_t x[4]= { 0.1, 0.2, 0.4, 0.5 };
Float_t y[3]= { 1.1, 1.2, 1.4 };
h2->Draw();

TH1F *h = new TH1F("","",3, x);
h->SetBinContent(1,y[0]);
h->SetBinContent(2,y[1]);
h->SetBinContent(3,y[2]);

h->Draw("same");
}

gives:
Error in <TGraph::PaintGraphHist>: X must have N+1 values with option N

but it has ... 3 bins -> 4 x-values

Ciao
Thomas

----------------------------------------------------------------------------
Thomas Hadig, Ottensen, Donnerstr. 20, 22763 Hamburg  Tel.  +49 40 39901186
OFFICE : DESY/H1, 1a334, Notkestr. 85, 22607 Hamburg  Tel.  +49 40 8998 2733
     hadig@rwth-aachen.de                             Handy +49 170 7807434   
     http://www-h1.desy.de/~hadig/                    FAX   +49 40 8998 4385
----------------------------------------------------------------------------
      PLEASE NOTE THE NEW OFFICE, OFFICE PHONE AND MOBILE PHONE !!!!!
----------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET