Re: [ROOT] How Can I write a number using latex, in ROOT

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Sep 05 2003 - 21:19:17 MEST


Replace your two last lines by

 l.DrawLatex(45,13.0, Form("L = %f",L));
 l.DrawLatex(45,12.2, Form("D = %f",d));


Rene Brun

On Fri, 5 Sep 2003, Gunasingha 
Rathnayaka 
wrote:

> Hi,
>    In the following, I am trying to get the parameters from the fitting
> function and write those values to the figure using latex. I could not
> find a way to put those values other than typing by hand. 
>    Can somebody help me two fix the last two lines.
> 
> Thank you,
> 
> Rath
> 
>  I am using ROOT 3.05/05 , RedHat 8.0 Linux
> +++++++++++  ++++++++++++++++++++++++++++++++++++++++++
>   
>  {
> gROOT->Reset();
> Double_t L,d;
> ntuple->Draw("x:y>>h1","","profs");
> TLatex l;
> l.SetTextFont(48);
> l.SetTextSize(20);
> h1->GetXaxis()->SetTitle("x");
> h1->GetYaxis()->SetTitle("y");
> gStyle->SetOptFit();
> h1->Fit("pol1");
> h1->SetMaximum(50.);
> c1->SetFillColor(0);
> gStyle->SetFillColor(0);
> L = h1->GetFunction("pol1")->GetParameter(1);
> d = h1->GetFunction("pol1")->GetParameter(0);
> 
> // How do I fix these two lines
> 
> l.DrawLatex(45,13.0, "L = %f",L);
> l.DrawLatex(45,12.2, "D = %f",d);
> 
> }
> 
> 



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