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

From: Jamila Hussain (jamila@phys.columbia.edu)
Date: Mon Mar 01 2004 - 21:42:33 MET


PS-- I am using the latest version 4.00/02

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();
> }
>
>
>
>
>
>
>
>
>
>
>
>



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