Re: canvas plots

From: DEBASISH DAS <debasish_at_rcf.rhic.bnl.gov>
Date: Sat, 12 Nov 2005 09:50:32 -0500 (EST)


Dear Rene

   thanks very much!
It worked.
regards
debasish.
> See example below
>
> Rene Brun
>
>
> #include "TCanvas.h"
> #include "TH1.h"
> #include "TFile.h"
>
> void das() {
> //save a canvas named "c1" to 4 different files
> //create a new canvas divised 2x2 and draw each "c1" canvas
> //in one of the pads
>
> TH1::AddDirectory(kFALSE);
> TH1F *h = new TH1F("h","test",100,-3,3);
> TCanvas *c1 = new TCanvas("c1");
> Int_t i;
> for (i=1;i<=4;i++) {
> h->FillRandom("gaus",1000);
> h->DrawCopy();
> c1->Print(Form("c1_%d.root",i));
> }
> delete c1;
> TCanvas *c2 = new TCanvas("c2");
> c2->Divide(2,2);
>
> TFile *f;
> for (i=1;i<=4;i++) {
> f = TFile::Open(Form("c1_%d.root",i));
> TCanvas *c = (TCanvas*)f->Get("c1");
> c->Draw();
> c2->cd(i);
> c->DrawClonePad();
> delete c;
> delete f;
> }
> }
>
>
> On Sat, 12
> Nov 2005,
> DEBASISH DAS wrote:
>
>> Hi
>> I have 4 sets of "canvas.root" files with canvas name "c1".
>> I want to superimpose 4 sets on one canvas divided in 4 pads for proper
>> representation and comparison.
>> Is that possible.
>> regards
>> debasish.
>>
>
Received on Sat Nov 12 2005 - 15:50:44 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET