Re: regarding fitting of curve

From: Olivier Couet <>
Date: Thu, 12 May 2005 11:54:47 +0200 (CEST)

Here is a small example. I guess it answers your two questions.

Cheers, O.Couet


   c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);                                                                                 


   const Int_t n = 20;
   Double_t x[n], y[n];
   for (Int_t i=0;i<n;i++) {

     x[i] = i*0.1;
     y[i] = 10*sin(x[i]+0.2);

   gr = new TGraph(n,x,y);

   gr->SetTitle("a simple graph");

   TLegend *legend=new TLegend(0.5,0.5,0.7,0.7);



On Thu, 12 May 2005, Sushil Singh Chauhan wrote:

> Dear sir,
> I am plotting some plots using root. I fist plot the data point and
> then fit that using the option provided in the root.Finally the fitting
> is shown by the lines. But I am facing some problem which are:
> 1) I am not able to put the same line in the legend box. As I am
> plotting the two or more sets on the same plot so to distinguishe them i
> need to put there corrosponding line(after fitting) style in the legend
> box. I do not know how to do it. I saw the root mannual but I have not
> found anything regarding this.
> Is there any other way to do it?
> 2) How can I remove the boundry of the legend box. I mean I do not want
> to show the box in the plots.
> with best regards,
> sushil.

Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail:                            Phone:   +41 22 7676522
WWW:                    Fax:     +41 22 7670300
Received on Thu May 12 2005 - 11:54:52 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET