Re: Superimposiong 2 TGraphs

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Mon, 21 Nov 2005 17:15:21 +0100 (CET)

Can you send the modified version of twoscales.C you have ?

On Mon, 21 Nov 2005, Alexander Wagner wrote:

> Hi!
>
> Simple minded as I am I tried to use the tutorial
> http://root.cern.ch/root/html/examples/twoscales.C.html
>
> to superimpose 2 TGgraphs. Shouldn't this work as the TGraph
> contains a TH inside?
>
> First problem: "same" seems to do nothing if I want to draw
> the second graph.
>
> Second problem: Scale() does nothing when applied to a
> TGraph the follwoing way (maybe it is wrong?)
>
> TGraph *grasy = new TGraph();
> grasy->GetHistogram()->Scale(scale);
>
> My current work arround for 1 is to crate a TH1 object just
> for the axes.
>
> The work arround for 2 is
>
> for (Int_t i = 0; i <= Points; i++)
> {
> Double_t x, y;
> grasy->GetPoint(i, x, y);
> grasy->SetPoint(i, x, y*scale);
> }
>
> Does this work as designed or is there a more elegant
> solution to superimpose two TGraphs with different scales?
>
> Root is Version 4.04/02b (current production) on Linux
> (Debian Sarge).
>
>

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet_at_cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7670300
Received on Mon Nov 21 2005 - 17:15:26 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET