Re: [ROOT] Problem with TGraph axes

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Jan 11 2003 - 10:00:29 MET


Set the number of of primary/secondary divisions, eg

{
   gROOT->Reset();
   TCanvas c1("c1");
   Double_t xmin = 5;
   Double_t xmax = 10;
   TH1F h("h","test",100,xmin,xmax);
   h.FillRandom("expo",1000);
   h.SetStats(0);
   h.Draw();
   c1.Update();
   Double_t ymax = c1.GetUymax();
   TF1 faxis("faxis","1/(x*x)",1/(xmax*xmax),1/(xmin*xmin));
   TGaxis axis(xmin,ymax,xmax,ymax,"faxis",204,"-");
   axis.SetLabelSize(0.03);
   axis.Draw();
}

Rene Brun

On Fri, 10 Jan 2003, Matthew Wood wrote:

> Hi again.  If I wanted to do the same thing but make my function
> 1/(coordinate of bottom axis)^2 is there anyway to keep the tick marks
> from getting all bunched together on one side.  Thanks.
> 
> Matthew Wood
> 
> On Fri, 10 Jan 2003, Rene Brun wrote:
> 
> > Hi Matt,
> > 
> > An example:
> > 
> > {
> >    gROOT->Reset();
> >    TCanvas c1("c1");
> >    Double_t xmin = 5;
> >    Double_t xmax = 10;
> >    TH1F h("h","test",100,xmin,xmax);
> >    h.FillRandom("expo",1000);
> >    h.SetStats(0);
> >    h.Draw();
> >    c1.Update();
> >    Double_t ymax = c1.GetUymax();
> >    TF1 faxis("faxis","1/x",1/xmax,1/xmin);
> >    TGaxis axis(xmin,ymax,xmax,ymax,"faxis",515,"-");
> >    axis.SetLabelSize(0.03);
> >    axis.Draw();
> > }
> > 
> > Rene Brun
> > 
> > 
> > 
> > On Fri, 10 Jan 2003, Matthew Wood wrote:
> > 
> > > Hi.  I am trying to draw a TGraph with two sets of x axes.  I would like
> > > to have a top axis that displays 1/(coordinate of bottom axis).  I have
> > > been able to add a top axis that has different limits than the bottom axis
> > > but I can't figure out how to make the values of the top axis a function
> > > of those of the bottom axis.  Perhaps this is the wrong way to approach
> > > this problem.
> > > 
> > > Matthew Wood
> > > 
> > 
> 
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET