On Tuesday, April 6, 2004, 16:37 +0200, Olivier Couet wrote:
>
> Hi,
>
> Have you a little example illustrating your problem ?
>
> Cheers, Olivier
>
> On Tue, 6 Apr 2004, Kay Ulbrich wrote:
>
> > Hello,
> > [ ... a lot loquatious of talk by me ... ]
> > Thank you for hints,
> > Kay
> >
> >
> >
>
> --
> Org: CERN - European Laboratory for Particle Physics.
> Mail: 1211 Geneve 23 - Switzerland Mailbox: J25910
> E-Mail: Olivier.Couet@cern.ch Phone: +41 22 7676522
> WWW: http://cern.ch/Olivier.Couet/ Fax: +41 22 7677155
>
Hello Olivier,
thank you for your prompt answer. Sorry, that it took me some time to
give an example, because I have encapsuled the
margin-set-functionality in a separate class derived from TCanvas.
Anyway, the example (a modfied one from Rene Brun in the thread I
mentioned first) does the same. So one sees, that the "middle"
histograms are wider than the outer ones. The same would apply to
the height, if I had more than 2 rows.
I actually want to have all histograms the same size. On the other
hand, I do not want to set ALL margins to 0 (this would do it),
because then I would have to add the axis labels manually i.e. by
using xfig.
I could live with adding the axis titles by an external program, but
here it would be nice as well to "embed" the canvas (c1 in the
example) centrally in a slightly bigger one and position
TPaveText-objects relative to the NDC of the bigger canvas.
I have seen PAW generated plots which looked as I would like, but I
have abstained from PAW and started with ROOT right away ...
Greetings,
Kay
--
======================================================================
Kay Ulbrich
Helmholtz-Institut fuer
Strahlen- und Kernphysik
der Universitaet Bonn Tel.: +49-228-73 1768
Nussallee 14-16 Institute FAX: +49-228-73 2505
D-53115 Bonn, Germany E-mail: ulbrich@iskp.uni-bonn.de
======================================================================
// example of script showing how to divide a canvas
// into adjacent subpads + axis labels on the top and right side
// of the pads.
#define ASPECT_RATIO (2.0/3.0) // Y / X
#define SCALE 10
#define X (100 * SCALE)
#define Y (X * ASPECT_RATIO)
void stack() {
TCanvas *c1 = new TCanvas("c1","multipads", X, Y);
c1->SetFixedAspectRatio(true);
gStyle->SetPadBorderMode(0);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
c1->Divide(3,2,0,0);
TH1F *h1 = new TH1F("h1","test1",20,-3,3);
h1->SetMarkerStyle(21);
h1->Sumw2();
TH1F *h2 = (TH1F*)h1->Clone("h2");
TH1F *h3 = (TH1F*)h1->Clone("h3");
TH1F *h4 = (TH1F*)h1->Clone("h4");
TH1F *h5 = (TH1F*)h1->Clone("h5");
TH1F *h6 = (TH1F*)h1->Clone("h6");
h1->FillRandom("gaus",500); h1->SetMaximum(80);
h2->FillRandom("gaus",300); h2->SetMaximum(80);
h3->FillRandom("gaus",900); h3->SetMaximum(130);
h4->FillRandom("gaus",500); h4->SetMaximum(130);
h5->FillRandom("gaus",500); h5->SetMaximum(130);
h6->FillRandom("gaus",500); h6->SetMaximum(130);
c1->cd(1);
gPad->SetBottomMargin(0);
gPad->SetRightMargin(0);
h1->Draw();
c1->cd(2);
gPad->SetLeftMargin(0);
gPad->SetBottomMargin(0);
gPad->SetRightMargin(0);
h2->Draw();
c1->cd(3);
gPad->SetLeftMargin(0);
gPad->SetBottomMargin(0);
h3->Draw();
c1->cd(4);
gPad->SetTopMargin(0);
gPad->SetRightMargin(0);
h4->Draw();
c1->cd(5);
gPad->SetTopMargin(0);
gPad->SetRightMargin(0);
gPad->SetLeftMargin(0);
h5->Draw();
c1->cd(6);
gPad->SetTopMargin(0);
gPad->SetLeftMargin(0);
h6->Draw();
}
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET