Hi Bernd, You should set the axis titles for the first histogram used to draw the axis, not the one drawn with "same" Simply replace "hx" by "hx2" in hx->GetXaxis()->SetTitle("fraction of lifts (fm2,4,5,6)"); hx->GetYaxis()->SetTitle("avg(pullforce) [gF]"); Rene Brun Bernd Reinhold wrote: > > Hi! > > The following function works fine (without error-message), except that the axis-title is not drawn or is not visible. > I can't see, why... > I execute it from within root with .x test.c > root is 3.10/02 on a CERN RedHat 7.3 > > Can you help me? > > Thanks, Bernd. > > void test(){ > gStyle->SetOptFit(1111); > gStyle->SetOptStat(0); > TFile *F=new TFile("bare_PA_before_localdb.root"); > TTree *groupby_PA_batch=(TTree*)F->Get("before_localdb"); > groupby_PA_batch->Draw("mean:liftspercentage>>hx(60,-5,105,60,0,14)","mean>0","E, goff"); //this to set the limits of the axes of the canvas... > //groupby_PA_batch->Draw("avg_all:count_rel2+count_rel4+count_rel5+count_rel6>>hx","","E, goff"); > TH2D *hx2=(TH2D*)hx->Clone(); > hx2->SetMarkerColor(kWhite); > hx->SetMarkerColor(kBlack); > hx->SetMarkerStyle(kFullSquare); > hx->SetMarkerSize(0.65); > hx->GetXaxis()->SetTitle("fraction of lifts (fm2,4,5,6)"); > hx->GetYaxis()->SetTitle("avg(pullforce) [gF]"); > TCanvas *cf=new TCanvas("cf", "my beautiful canvas"); > cf->SetFillColor(kWhite); > hx2->Draw(); > TBox *b0 = new TBox(20,9,105,14); > b0->SetFillColor(19); > b0->Draw(); > TBox *b1 = new TBox(10,6,105,9); > b1->SetFillColor(33); > b1->Draw(); > TBox *b2= new TBox(-5,0,105,6); > b2->SetFillColor(33); > b2->Draw(); > hx->Draw("same"); > }
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET