Re: [ROOT] TLegend

From: Perrot Luc (perrot@isn.in2p3.fr)
Date: Tue Apr 04 2000 - 09:52:13 MEST


    Hi Rene,
 Your proposittion do not modify my problem. It is independent to the position and
size of the legend.

Luc


Rene Brun wrote:

> Hi Luc,
> I have modified your example below to get it working.
> See lines marked with <====
>
> Rene Brun
>
> On Mon, 3 Apr 2000, Perrot Luc wrote:
>
> >
> >     Hello rooters,
> >
> > I use root version 2.23/12 on DEC/ALPHA. I have this example for see you my
> > problem of the last week.
> >
> > My little macro is very simple:
> >
> >
> > {
> >
> >  Int_t nbr_bin_simu = 11;
> >  TH1F *target = new TH1F("target","test",nbr_bin_simu+1,0,nbr_bin_simu);
> >  FILE *pfic = fopen("ascii_2.dat","r");
> >  Int_t  ncols,i=0;
> >  Float_t x,y;
> >  while (1)
> >  {
> >   ncols = fscanf(pfic,"%f %f",&x, &y);
> >   if ((ncols < 0) || (i == nbr_bin_simu)) break;
> >   cout<<x<<" "<<y<<endl;
> >   target->Fill(x,y);
> >   i++;
> >  }
> >  fclose(pfic);
> >
> >  TCanvas *c1 = new TCanvas("c1","test",30,30,600,600);
> >  TLegend *leg = new TLegend(0.6,0.7,0.8,0.76); //<=======
> >  leg->SetTextSize(0.03);  //<========
>    leg->AddEntry(target,"tantale","l");
> >
> >  c1->cd();
> >  //c1->SetLogy();
> >  target->Draw();
> >  leg->Draw();
> >
> > }
> >
> > This macro call this ascii file:
> >
> > 0.0 1.00e-3
> > 1.0 1.01e-3
> > 2.0 1.02e-3
> > 3.0 1.03e-3
> > 4.0 1.04e-3
> > 5.0 1.05e-3
> > 6.0 1.06e-3
> > 7.0 1.07e-3
> > 8.0 1.08e-3
> > 9.0 1.09e-3
> > 10.0 1.10e-3
> >
> > When i execute the macro on my DEC is:
> >
> >  *** Break *** floating point exception
> >
> > But i use the selection c1->SetLogy(), there is no problem, the plot is ok.
> >
> > When i replace in the ascii file e-3 by e-2 or more bigger, i can see my plot
> > with the legend.
> > If i put in comment the line: leg->Draw(); there is no problem whatever the
> > value selected
> >
> > If i use this macro with Linux on a PC, there is no matter at all.
> >
> >
> > Thanks for your help.
> >
> > Luc Perrot
> >
> >
> > ----------------------------------------------------------
> > Luc Perrot   E-mail:perrot@isn.in2p3.fr
> > ISN 53 avenue des Martyrs 38026 GRENOBLE cedex
> > Tel: 76-28-40-00 poste 43-14
> > Fax: 76-28-40-04
> > ----------------------------------------------------------
> >
> >



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:22 MET