When using TAxis::SetRange, you have to specify 2 arguments binmin and binmax. Example: { TH1F h("h","test",100,-4,4); h.FillRandom("gaus",10000); h.GetXaxis()->SetRange(50,80); h.Draw(); } Rene Brun Junjie Zhu wrote: > > Hi, > I draw a histogram, but the range of x axis is too broad, so I want to > change it to a certain range. I tried the command > f->GetXaxis()->SetRange(), but it did not work. > > TPad *p=new TPad("p","pad",.1,.1,1.,1.); > Global->Draw("pt") //draw a histogram of a transverve momentum > but the default range of pt is -30 to 30, I am only interested in the > range from 0 to 20, how can I change it? By the way,I do not want to use > the definition of histogram TH1F *h=new TH1F("h","histogram",100,0.,20.)
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET