Re: Problems with Histograms

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Dec 12 1998 - 11:07:25 MET


Robert Willson wrote:
> 
> I'm just beginning with root, so please excuse the ignorance.  Here's my
> file:
> 
> void newprog() {
> 
>   c1 = new TCanvas("c1", "Stupid", 20, 10, 800, 600);
>   pad1 = new TPad("pad1", "First", 0.02, 0.7, 0.97, 0.97, 17, 3);
>   pad2 = new TPad("pad2", "Second", 0.02, 0.4, 0.97, 0.65, 17, 3);
>   pad3 = new TPad("pad3", "Third", 0.02, 0.02, 0.97, 0.35, 17, 3);
> 
>   pad1.Draw();
>   pad2.Draw();
>   pad3.Draw();
> 
>   TH1F *histo1 = new TH1F("Num1", "0.0001", 100, 0.0, 100.0);
>   TH1F *histo2 = new TH1F("Num2", "0.00001", 100, 0.0, 100.0);
>   TH1F *histo3 = new TH1F("Num3", "0.000001", 100, 0.0, 100.0);
>   Double_t x, w1, w2, w3;
> 
>   for (x=0.0; x<100.0; x=x+1.0) {
> 
>     w1 = 3.0 - x*x + 10.0*x + 0.01*x*x*x - 0.0001*x*x*x*x;
>     w2 = 3.0 - x*x + 10.0*x + 0.01*x*x*x - 0.00001*x*x*x*x;
>     w3 = 3.0 - x*x + 10.0*x + 0.01*x*x*x - 0.000001*x*x*x*x;
> 
>     histo1.Fill(x,w1);
>     histo2.Fill(x,w2);
>     histo3.Fill(x,w3);
> 
>   }
> 
>   pad1.cd();
>   histo1.Draw("C");
>   pad2.cd();
>   histo2.Draw("C");
>   pad3.cd();
>   histo3.Draw("C");
> }
> 
> The first histogram is plotting, but the second and third are not.  Any
> suggestions?
> 
> Thanks,
> 
> Robert Willson
> willson@pacific.mps.ohio-state.edu


Hi Robert,
Your histograms 2 and 3 have negative contents. This gives problems
with the Draw("C") option. Use no option Draw() or Draw("L")
and you will see your histograms.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:40 MET