Re: [ROOT] Adding pre-existing histograms into TPad

From: Pietro Govoni (Pietro.Govoni@cern.ch)
Date: Tue Jul 09 2002 - 10:10:20 MEST


Hello Mr. Marotta,
Having different histograms and different pads I use a code like this to
draw the histograms:

{
// create a canvas

    TCanvas *c1 = new TCanvas("c1","canvas1",100,10,900,820);

// create pads and draw them

    TPad *pad1 = new TPad("pad1","one", 0, 0.5, 0.5, 1);
    TPad *pad2 = new TPad("pad2","two", 0.5, 0.5, 1, 1);
    TPad *pad3 = new TPad("pad3","three", 0, 0, 0.5, 0.5);
    TPad *pad4 = new TPad("pad4","four", 0.5, 0, 1, 0.5);
    pad1->Draw();
    pad2->Draw();
    pad3->Draw();
    pad4->Draw();

// go into each pad and draw your existing histograms

    pad1->cd();
    hist01->Draw();
    pad2->cd();
    hist02->Draw();
    pad3->cd();
    hist02->Draw();
    pad4->cd();
    hist02->Draw();
}


I hope I gave you a useful suggetion, best regards

pietro




On Mon, 8 Jul 2002 jpmarott@email.arizona.edu wrote:

>Hello,
>I am trying to draw several (4) histograms that have already been booked,
>filled, and written to file into a pre-existing, subdivided TCanvas object.
> The ROOT manual says that this can be done quite easily, but I'm completely
>unclear as to how.  I would assume that you could say something like:
>histname = TPad->Draw(); 
> 
>but this seems to give me a segmentation fault.  Is there something that
>I completely missed?  If there's any easier way of displaying multiple histograms
>on the same canvas, please, let me know.
>Thanks,
>Joe Marotta
>
>



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET