RE: [ROOT] Getting axes from frame ...

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Aug 19 2003 - 16:32:31 MEST


Hi Matej,

The frame does not have access to the Axis objects.  Instead DrawFrame
creates a TH1F named hframe who does have access to the Axis.  This TH1F
object's address is returned by DrawFrame.  Hence you can do:

   pad1 = new TPad("pad1","This is pad1",0.02,0.02,0.98,0.98,33);
   pad1->SetFillColor(10);
   TH1F* histo = pad1->DrawFrame(-0.5,170,10.5,360);
   histo->GetXaxis()->SetTitle("test");
   TFrame *frame= pad1->GetFrame();
   frame->SetFillColor(10);

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of matej batic
Sent: Tuesday, August 19, 2003 4:46 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] Getting axes from frame ...


Hi, there!

I have two graphs on different ranges, so I create pad with frame in
order to get them both printed out. The problem arises when I want to
set titles to the axes. What I do is:

pad1 = new TPad("pad1","This is pad1",0.02,0.02,0.98,0.98,33);
pad1->SetFillColor(10);
pad1->DrawFrame(-0.5,170,10.5,360);
TFrame *frame= pad1->GetFrame();
frame->SetFillColor(10);

This works. The problem arises when I try something similar to

frame->GetXaxis()->SetTitle("test");

Any idea?

Thanks,
Matej

--
----
   Matej Batic
-----------------
Xerox does it again and again and again and ...



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET