Re: : Re: [ROOT] two histograms with two different scales and different origins (Reply to message posted March 5, 2002 by Rene Brun)

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Tue Mar 02 2004 - 10:06:43 MET


 Hello,

 To do what you want it was not the best example to start with, I guess ... 
I have put in attachment one of the root examples (in tutorial) which, 
seems to me, reflects better what you explained in your email.

 Cheers,       Olivier



On Mon, 1 Mar 2004, Jamila Hussain wrote:

> Hello Rooters,
> 
> I have tried to produce a plot with the axis of one histogram plotted on
> the left side of the pad, and the axis of the other histogram on the right
> side.  Since the scales differ by two orders of magnitude with different
> minima, I thought to use the TProfile class as below.  However, if I replace
> 
> h1->Draw();     with h1->Draw("ah");
> 
> the left axis still plots.  How can I suppress plotting
> of the y-axis of one of the histograms?  Is the "ah" option designed to
> work for the TProfile::Draw ?
> 
> 
> Thanks,
> Jamila Hussain
> 
> 
> {
>    TH1F *h1 = new TH1F("h1","h1",100,-4,4);
>    TProfile *h2  = new TProfile("h2","pz vs px",100,-3,3,0,20);
>    Float_t px, py, pz;
>    for (Int_t i = 0; i < 25000; i++) {
>      gRandom->Rannor(px,py);
>      pz = px*px + py*py;
>      h1->Fill(px);
>      h2->Fill(px,pz);
>    }
>    h1->Draw();
>    TPad *pad = new TPad("pad","pad",0,0,1,1);
>    pad->SetFillStyle(4000);
>    pad->SetFrameFillStyle(4000);
>    pad->Draw();
>    pad->cd();
>    pad->SetLeftMargin(0.2);
>    pad->SetBottomMargin(0.2);
>    h2->Draw();
> }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155





This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET