Re: [ROOT] Question about my macro

From: Pietro Govoni (pietro.govoni@cern.ch)
Date: Wed May 29 2002 - 17:10:38 MEST


Dear Mr. Rustige,
I'm a ROOT new user, so I can suggest you a solution for the second 
problem, only.
I usually create manually the pads, so I can set their dimensions.


    TCanvas *c4 = new TCanvas("c4","salca",100,10,900,820);

   TPad *pad41 = new TPad("pad41","one", 0, 0.5, 0.5, 1);
    TPad *pad42 = new TPad("pad42","two", 0.5, 0.5, 1, 1);
    TPad *pad43 = new TPad("pad43","three", 0, 0, 0.5, 0.5);
    TPad *pad44 = new TPad("pad44","four", 0.5, 0, 1, 0.5);
    pad41->Draw();
    pad42->Draw();
    pad43->Draw();
    pad44->Draw();


cheers

pietro

Tobias Rustige wrote:

> Dear rooters,
>
>  
>
> I wrote the following macro:
>
>  
>
> {
>    gROOT->Reset();
>    TCanvas c1("c1","multipads",500,500);
>    gStyle->SetPadBorderMode(0);
>    gStyle->SetOptStat(0);
>    c1.Divide(2,2,0,0);
>    TH2F h1("h1","test1",100,-10,10,180,0,180);
>    TH2F h2("h2","test3",50,-5,5,180,0,180);
>    TH2F h3("h3","test4",10000,-10,10,1800,0,180);
>   
>    ifstream in;
>    in.open("basic.dat", ios::in);
>
>  
>
>    Float_t x,y,z;
>    Int_t nlines = 0;
>   
>    while (1) {
>       in >> x >> y ;
>       if (!in.good()) break;
>       h1->Fill(x,y);
>       h2->Fill(x,y);
>       h3->Fill(x,y);
>      
>       nlines++;
>    }
>    printf(" found %d points\n",nlines);
>
>  
>
>    in.close();
>
>  
>
>    c1.cd(1);
>    gPad->SetBottomMargin(0);
>    gPad->SetRightMargin(0);
>    gPad->SetTickx(2);
>    h1->SetOption("lego");
>    h1.Draw();
>
>  
>
>    c1.cd(2);
>    gPad->SetLeftMargin(0);
>    gPad->SetBottomMargin(0);
>    gPad->SetTickx(2);
>    gPad->SetTicky(2);
>    h1.GetYaxis()->SetLabelOffset(0.01);
>    h1->SetOption("surf3");
>    h1.Draw();
>   
>    c1.cd(3);
>    gPad->SetTopMargin(0);
>    gPad->SetRightMargin(0);
>    h2->SetOption("scat");
>    h2.Draw();
>
>  
>
>    c1.cd(4);
>    gPad->SetLeftMargin(0);
>    gPad->SetTopMargin(0);
>    gPad->SetTicky(2);
>    h2->SetOption("surf3");
>    h2.Draw();
>
> }     
>
>  
>
>  
>
> There, as you can see , are several plotting options, intended to get 
> printout with two different types of plottingts in every line based on 
> the values in the data basic.dat, which contains the raw data of a 
> sinogram. But if you look what happens in root , it is the following:
>
>  
>
>  
>
>  
>
> So you see, although I sayd that ar least two pictures should be a 
> scatter plot, always the same type of plotting appears.
>
>  
>
> I do not understand this, where is my mistake ??
>
>  
>
> Please heeelp me.
>
>  
>
>  
>
> And how can I create between those pads of a canvas a little distance, 
> that it looks more nice.
>
>  
>
> Thanks for your commands
>
>  
>
>  
>
> With my best regards
>
>  
>
> Tobias Rustige
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>
>  
>



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET