Re: [ROOT] Axis numbers

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Nov 13 2000 - 14:47:03 MET


Hi Marc,
I cannot reproduce your problem.
You seem to use a complex logic to do simething simple.
You have anyhow a scoping problem in your function DrawHist.
The TPad pad1 object is automatically deleted when you exit from
the function.
Is it intended ? may be replacing the line
        TPad pad1("pad1","padje",0.05,0.55,0.45,0.95);
by

        TPad *pad1 = new TPad("pad1","padje",0.05,0.55,0.45,0.95);

is more appropriate?

Rene Brun

kamps wrote:
> 
> The following macro displays the two histograms, the axis numbers on the 2nd
> one look weird
> on my machine. WinNt - 2.25/03
> Best Regards,
>         Marc
> 
> ----------------------------------------------------------------------------
> ----------------
> TH1F* p_hist_fst;
> TH1F* p_hist_last;
> 
> TCanvas c1("c1","Control Histograms",10,10,1200,800);
> 
> void test()
> {
>         p_hist_fst  = new TH1F("bla1","ble",100,0.,100.);
>         p_hist_last = new TH1F("bla2","bli",100,0.,100.);
> 
>         DrawHist(p_hist_fst);
>         DrawHist(p_hist_last);
> }
> 
> void DrawHist( TH1F* p_hist )
> {
> 
>         gStyle->SetStatW(0.3);
>         gStyle->SetStatH(0.3);
> 
>         TPad pad1("pad1","padje",0.05,0.55,0.45,0.95);
> 
>         pad1->Draw();
> 
>         pad1->cd();
> 
>         p_hist->Draw();
> 
>         c1->Modified();
>         c1->Update();
> 
>         char bla[10];
>         printf("Type something to see nxt histo\n");
>         scanf("%s",bla);
> }



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