[ROOT] Re: Latex in title axis

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Wed Dec 17 2003 - 09:47:03 MET


Hi Christian,

 I have no problem to put Latex text in the axis titles, try:

{
   TCanvas *c1 = new TCanvas("c1", "c1",200,10,700,500);                     
   c1->Range(-5,-110.513,5,994.613);
   TH1 *hpx = new TH1F("hpx","This is the px distribution",100,-4,4);
   hpx->GetXaxis()->SetTitle(" M_{2} (GeV) ");
   hpx->GetXaxis()->SetTitleFont(42);
   hpx->Draw("");
}

Cheers,      Olivier


On Wed, 17 Dec 2003, Christian Hansen wrote:

> 
> Dear Rooters,
> 
> Since I did not manage to write Latex code in my axis titles
> I tried TLatex for the axis titles instead. However, I encountered
> two problems;
> 
> 1) I did not manage to turn the text for the y-axis around. I tried
> 
> 	TLatex* text = new TLatex();
>   	text->SetTextSize(0.03);
>   	text->DrawLatex(0.45,0.05," #mu (GeV) ");
>   	text->PaintLatex(0.05,0.5,1.57,0.03," M_{2} (GeV) ");
>   	text->DrawLatex(0.05,0.5," M_{2} (GeV) ");
> 
>    but even though I'm trying to put theta to 1.57 the M_2 
>    is still written horisontally instead of vertically.
> 
> 2) If I before the line with TLatex* draw the histogram
> 
> 	m_2dHist_m2VsMy->Draw("CONTZ");
>   	TLatex* text = new TLatex()
> 
>    I get the error message
> 
> 	Error in <TGaxis::PaintAxis>: wmin (0.033741) == wmax (0.033741)
> 
>    and both the texts (mu and M2) ends up in the same place in 
>    the Canvas.
> 
> If anyone could help me with these problems or how to write Latex code for 
> the axis titles I would be very greatful. 
> 
> Cheers
> 

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155



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