Superimposiong 2 TGraphs

From: Alexander Wagner <a.wagner_at_physik.uni-wuerzburg.de>
Date: Mon, 21 Nov 2005 16:49:29 +0100


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).

-- 

Kind regards,                /                 War is Peace.
                            |            Freedom is Slavery.
Alexander Wagner            |         Ignorance is Strength.
                            |
                            | Theory     : G. Orwell, "1984"
                           /  In practice:   USA, since 2001
Received on Mon Nov 21 2005 - 16:49:19 MET

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