Paves and Graphs

ROHLFS Reiner (Reiner.Rohlfs@obs.unige.ch)
Wed, 03 Dec 1997 16:10:57 +0100 (MET)


Hi ROOTers,

I want to draw a pave and a graph in the same pad. But the pave should be on
top of the graph.

Here is my test macro:

{
gROOT->Reset();

c1 = new TCanvas("c1","canvas",10,0,350,470);
pad = new TPad("pad", "pad", 0.1, 0.1, 0.9, 0.9);
pad->Draw();
pad->cd();

float x[] = {0., 1.5, 2.};
float y[] = {0., 0.8, 2.};
graph = new TGraph(3,x,y);

pave = new TPaveText(0.5, 0.8, 1.0, 1.0);
pave->AddText("This is a pave");

pave->Draw();
graph->Draw("AL");

}

But now the graph is on top of the pave and you can see only part of the pave.

If I call first
graph->Draw("AL");
and than
pave->Draw();
the pave is on top of the graph. But the coordinates defined in the pave
constructor now are interpreted in the range of the frame of the already drawn
graph. I'm not able to place the pave at the top right corner of the pad
because I'm not allowed to define coordinates > 1.0 in the pave constructor.
Anyhow I think it is a bad idea to define the pave coordinates in the range of
the graph because the graph coordinated may be unknown while the pave is
created.

Is there a function to put the pave on top of the graph after both are drawn?

Cheers Reiner.