Hi Atila, If you want to control the position of your TGaxis while rotating your 2-d histogram, you can use the TExec mechanism. See an example below Rene Brun //file cexec.C // root > .x cexec.C // when zooming on the x or y axis of the contour plot // the projection will automatically be zoomed TH2F *h2; TPad *pad2; TH1D *hp; void cexec() { h2 = new TH2F("h2","h2",30,-3,3,30,-3,3); Double_t x,y; for (Int_t i=0;i<10000;i++) { gRandom->Rannor(x,y); h2->Fill(x,y); } TCanvas *c1 = new TCanvas("c1","c1",10,10,800,500); c1->Divide(2,1); c1->cd(2); pad2 = (TPad*)gPad; c1->cd(1); h2->Draw("cont"); TExec *ex = new TExec("ex","cproject()"); h2->GetListOfFunctions()->Add(ex); hp = 0; } void cproject() { TAxis *xaxis = h2->GetXaxis(); TAxis *yaxis = h2->GetYaxis(); Int_t ixmin = xaxis->GetFirst(); Int_t ixmax = xaxis->GetLast(); Int_t iymin = yaxis->GetFirst(); Int_t iymax = yaxis->GetLast(); if (hp) delete hp; hp = h2->ProjectionX("hp",iymin,iymax); hp->GetXaxis()->SetRange(ixmin,ixmax); pad2->cd(); hp->Draw(); } On Mon, 10 Jun 2002, Atila Alves Neves wrote: > > When painting histograms, TGaxis is used to paint the histogram axis. > > There is currently no way to specify the option "-" between TAxis > > and TGaxis. You have to draw a TGaxis yourself. > > Ok. In that case, is there any way I can align a TGAxis when showing a > TH2 (not a TH1, I made a mistake on the email title) in 3D mode, e.g. > using option "surf1" or "lego"? I can position them on top of the regular > x and y axes if the TH2 is shown in 2D, e.g. "col". As soon as you rotate > the histogram in 3D mode... the drawn TGaxis just stays in place. > > > > > Rene Brun > > > > On Sun, 9 Jun 2002, Atila Alves Neves wrote: > > > > > Hi. I was wondering if there was any way to access the TGaxis > > > associated with a histogram axis? The thing is, I know how to make a > > > TGaxis count backwards by passing the "-" option in, but how do I achieve > > > the same effect with an axis belonging to a histogram? > > > Thanks in advance, > > > > > > Atila Neves > > > > > > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:56 MET