Re: getting a new canvas and..

Rene Brun (Rene.Brun@cern.ch)
Mon, 01 Feb 1999 13:23:56 +0100


Walid Majid wrote:
>
> dear rooters,
>
> i have a couple of questions related to the canvas and graph objects.
>
> how can i display a plot on a new canvas, keeping the previous canvas with
> its plots available - i don't want to overwrite it.
>

Hi Walid,
When you create a new canvas, this canvas becomes the current pad.
Objects drawn in other pads should not be affected when you draw
an object in the new canvas.

> my second question is given a TGraph object, how can i manipulate the
> label box - the title of the graph is too long and it doesn't fit the
> label box. i understand that using the GetHistogram method of TGraph i
> can get a pointer to a TH1F class.
>

By default, TGraph objects are unnamed. I assume you have called
TGraph::SetTitle("with a long title")
I would like to see this case. In principle the size of the TPaveLabel
object used to draw the title is computed as a function of the title
length.
Note that instead of calling TGraph::SetTitle, you can directly
create a TPaveLabel object with a given size and position.
TPaveLabel *myTitle = new TPaveLabel(x1,y1,x2,y2,"My long title");
myTitle->Draw();

Rene Brun