Re: [ROOT] Divide pad problem

From: Maxim Nikulin (nikulin@gorodok.net)
Date: Tue Feb 24 2004 - 15:03:29 MET


Hi,

Olivier and Rene, the zones.C macro produces a plot with collapsed and 
clipped labels. (ROOT-3.10/02, ROOT-4.00/02).

Are there any way to get equal label font sizes when a canvas contains a 
wide pad and a narrow one? I've attached the zones2.C macro to make the 
problem more clear.

-- 
Yours faithfully,
Maxim Nikulin

Olivier Couet wrote:
> Hi,
> 
>  May be you can have a look at the tutorial macro zones.C. (I put it is 
> attachment)
> 
>  Cheers,    Olivier
> 
> On Thu, 19 Feb 2004, Michael Groys wrote:
> 
> 
>>Hello,
>>I want to create plot with matrix of histograms.
>>Each one of them has the same x and y axis ranges.
>>So I want to plot axis labels once in the right side
>>and once in the bottom side of the matrix. In
>>addition I don't want margins between internal histograms.
>>
>>So I'm doing something like:
>>
>>f = new TF1("f", "x", 0, 1);
>>c = new TCanvas;
>>c->Divide(1,2,0,0);
>>c->cd(1);
>>gPad->SetBorderStyle(0);
>>gPad->SetBorderSize(0);
>>c->cd(2);
>>gPad->SetBorderStyle(0);
>>gPad->SetBorderSize(0);
>>c->cd(1);
>>gPad->SetBottomMargin(0);
>>f->Draw();
>>
>>In this case I got in the canvas truncated '0' label.
>>in y axis. Moreover in the postscript file this
>>label will not appear at all.
>>So my question is:
>>How I can avoid this problem, or may be there is
>>another way of drawing such matrix of histograms?
>>
>>Thanks in advance and best regards, Michael.
>>
>>PS. I' using root version 3.10/02


{
   gROOT->Reset();
   gStyle->SetOptTitle(0);
   TCanvas c1("c2pad","c2pad",900,700);
   gStyle->SetPadBorderMode(0);
   gStyle->SetOptStat(0);
   gStyle->SetPadTickX(1);
   gStyle->SetPadTickY(1);
   TH2F h2("h2", "h2", 10, 0, 1, 10, 0, 1);
   Int_t i;
   for(i = 0; i < 10000; ++i) {
      h2.Fill(gRandom->Exp(0.5), gRandom->Gaus(0.5, 0.2));
   }
   h1 = h2.ProjectionX("h1");
   h1->SetNdivisions(505, "Y");
   
   TPad top_pad("top_pad", "top_pad",0,0.2, 1.0, 1.0);
   top_pad.Draw();
   top_pad.cd();
   top_pad.SetBottomMargin(0);
   h2.Draw();

   c1.cd();
   TPad bottom_pad("bottom_pad", "bottom_pad", 0, 0., 1.0, 0.2);
   bottom_pad.Draw();
   bottom_pad.cd();
   bottom_pad->SetTopMargin(0);
   h1->Draw();
}      



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET