RE: Drawing histograms close together

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Fri, 16 Feb 2007 14:00:28 +0100


If you do not want to cut the labels on h1 and h2 you should do something like that:
{

TCanvas *c = new TCanvas("c","c",0,0,500,800);

c->Divide(1,3,0,0);

c->cd(1);

h1->SetLabelOffset(1.0,"x");

c_1->SetBottomMargin(0.04);

h1->Draw();

c->cd(2);

h2->SetLabelOffset(1.0,"x");

c_2->SetTopMargin(0.0);

c_2->SetBottomMargin(0.04);

h2->Draw();

c->cd(3);

h3->SetLabelOffset(0.005,"x");

c_3->SetTopMargin(0.0);

h3->Draw();

}


From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Ann-Cecilie Larsen Sent: Friday, February 16, 2007 1:32 PM
To: RootTalk
Subject: [ROOT] Drawing histograms close together

Dear Rooters,

I am trying to draw three histograms very close together in the vertical direction. In my script, I use:

c1->Divide(1,3);

c1->cd(1);
h1->SetLabelOffset(1.0,"x");
c1_1->SetBottomMargin(0.001);
h1->Draw();

c1->cd(2);
h2->SetLabelOffset(1.0,"x");
c1_2->SetTopMargin(0.0);
c1_2->SetBottomMargin(0.0);
h2->Draw();

c1->cd(3);
h3->SetLabelOffset(0.005,"x");
c1_3->SetTopMargin(0.0);
h3->Draw();

But the result is not very nice, the x axis of pad 1 (and 2) is sort of cut off, so only the ticks are visible. Also, the histograms are not placed near eachother, but still have some white space between them.
How can I draw them nicely together?

Thanks in advance,

Cecilie



Ann-Cecilie Larsen
Oslo Cyclotron Laboratory (http://ocl.uio.no/) Department of Physics, University of Oslo P.O.Box 1048 Blindern
N-0316 Oslo, Norway
Phone: +47 22 85 64 63 Fax: +47 22 85 64 22 E-mail: a.c.larsen_at_fys.uio.no
Received on Fri Feb 16 2007 - 14:00:34 CET

This archive was generated by hypermail 2.2.0 : Fri Feb 16 2007 - 23:50:01 CET