Re: getting a new canvas and..

From: S. P. Wakely (wakely@hep.umn.edu)
Date: Mon Feb 01 1999 - 16:03:48 MET


Hi Walid,

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

You can simply make a new canvas for each plot
TCanvas *c1 = new TCanvas("c1","CName1",1);
TCanvas *c2 = new TCanvas("c2","CName2",1);
c1->cd();
h1->Draw();
c2->cd();
h2->Draw();
This will generate two new canvases with one of the default sizes and
print two histograms in the different canvases.  If instead of this
you are asking how to get ROOT to automatically generate a new canvas
every time you call Draw(), I don't know of a way, though it seems
like it could be done with minor changes to the current code.

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

Try this:

YourGraph->Draw("ALP");
YourGraph->GetHistogram()->SetTitle("New Title");
or for axis titles:
YourGraph->GetHistogram()->GetXaxis()->SetTitle("New Axis Title");

Note that you must have already called TGraph::Draw() with the 'A'
option for this to work because it is this call which generates the
histogram object which is used to make the axes and title.

Hope that is useful,
Scott



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET