Re: [ROOT] 2 Histograms sharing a same x-axis

From: Marco van Leeuwen (mvl@nikhef.nl)
Date: Fri Jun 30 2000 - 09:36:03 MEST


Hi,

I once tried this, and it can more or less be done in the following way:

{
  gROOT->Reset();
  TCanvas *c1=new TCanvas("c1","Canvas #1");
  c1->Divide(1,2,0,0,0);
  c1->cd(1);
  gPad->SetBottomMargin(0.001);
  gPad->DrawFrame(0,0,1,100);
  c1->cd(2);
  gPad->SetTopMargin(0.001);
  gPad->DrawFrame(0,0,1,100);
}

I think the important thing here is not to set the margins to 0, because
this will result in some default value, but to some small value instead.
Note that the axis labels will get cut off at the edges of the pad...
(Instead of the DrawFrame() calls, you can also draw your histograms.)

Kind regards,

Marco van Leeuwen.

On Thu, 29 Jun 2000, Laurent APHECETCHE wrote:

> Hi Rooters,
> 
> I would like to plot 2 histograms which share the same x-axis :
> 
> ---------------
> |             |
> |             |
> |             |
> --|--|--|--|---
> |             |
> |             |
> |             |
> ---------------
> 
> I've tried to use TCanvas::Divide and play with the margins, but I
> failed.
> Any help ?
> 
> Thanks.
> -- 
> Dr. Laurent APHECETCHE (mailto:aphecetc@in2p3.fr) | TAPS/PHENIX/ALICE
> SUBATECH-Ecole des Mines de Nantes-4 rue Alfred Kastler-44070 NANTES
> cedex 03
> TEL (+33/0) 2 51 85 84 17 - FAX (+33/0) 2 51 85 84 24 (France)
> http://www-subatech.in2p3.fr/~photons -
> http://www.phenix.bnl.gov/~aphecetc
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET