Re: [ROOT] Elimination of suppressed zeros in graphs

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jan 07 2004 - 23:14:50 MET


Hi Kalen,

You can force your own range with something like:

{
   TCanvas *c1 = new TCanvas("c1");
   c1->DrawFrame(0,0,480,1);
	
   Int_t n = 7;

    Double_t ecm[n];
    Double_t nlr[n];

    ecm[0]=350 ; nlr[0]=0.80703;
    ecm[1]=370 ; nlr[1]=0.781981;
    ecm[2]=390 ; nlr[2]=0.762459;
    ecm[3]=410 ; nlr[3]=0.740626;
    ecm[4]=430 ; nlr[4]=0.718904;
    ecm[5]=450 ; nlr[5]=0.698587;
    ecm[6]=470 ; nlr[6]=0.677837;

    TGraph *theplot = new TGraph(n, ecm, nlr);
    theplot -> Draw("L");
}

Rene Brun

On Wed, 7 Jan 2004, Kalen 
Martens wrote:

> Hi Rene,
> 
> For example, I want to generate a graph with the following script:
> 
> {
> gROOT -> Reset();
> 
> Int_t n = 7;
> 
> Double_t ecm[n];
> Double_t nlr[n];
> 
> ecm[0]=350 ; nlr[0]=0.80703;
> ecm[1]=370 ; nlr[1]=0.781981;
> ecm[2]=390 ; nlr[2]=0.762459;
> ecm[3]=410 ; nlr[3]=0.740626;
> ecm[4]=430 ; nlr[4]=0.718904;
> ecm[5]=450 ; nlr[5]=0.698587;
> ecm[6]=470 ; nlr[6]=0.677837;
> 
> TGraph *theplot = new TGraph(n, ecm, nlr);
> theplot -> Draw("AL");
> }
> 
> I obtain a graph, but it doesn't include the orgin. I can fix this (in
> the y-direction only) by including a line before the graph is drawn:
> 
> theplot -> SetMinimum(0);
> 
> However, it seems I cannot do the same for the x-direction (axis). I was
> wondering if there was a way to do that.
> 
> I hope this makes my question more clear. I'm using ROOT 3.10-02.
> 
> 	-Kalen
> 
> -----------------------------------------------------------------
> 
> On Wed, 7 Jan 2004, Rene Brun wrote:
> 
> > Hi Kalen,
> >
> > I do not understand this problem. Could you send me the shortest
> > possible script reproducing it? Which version are you using?
> >
> > Rene Brun
> >
> > On Wed, 7 Jan
> > 2004, Kalen Martens wrote:
> >
> > >
> > > I have created a TGraph object from two arrays of Double_t data. All of
> > > the data is in the 1st quadrant. When I do a TGraph::Draw(), the graph is
> > > displayed nicely except that the zeroes are not included on the axes. I
> > > found that by using TGraph::SetMinimum() I can change the boundaries of
> > > the graph in the y-direction to include zero. However, I cannot see a way
> > > to achieve the same thing in the x-direction. Is there a way to do this?
> > >
> > > Many thanks in advance,
> > > 	-Kalen
> > >
> > > -----------------------------------------------------------------
> > > - Kalen Martens			 	     Ph:(416)-978-6632  -
> > > - Dept. of Physics						-
> > > - University of Toronto, Toronto, Canada			-
> > > -----------------------------------------------------------------
> > >
> >
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET