Re: [ROOT] Drawing a line in histogram in log mode

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 17 2002 - 13:01:59 MEST


Use a TGraph instead of a TLine.

Only high level objects like TH1, TF1, TGraph are able to switch
between lin and log modes.

Rene Brun

On Wed, 17 Jul 2002, Reinhardt Chamonal wrote:

> Hi,
> I have a minor problem:
> I am drawing a simple vertical line on my histogram as follows:
>     Int_t binminmean = xaxis->FindBin(tabMean[i]);
>     Double_t maxvalue=pedestal->GetMaximum();
>     l=new TLine(binminmean,0,binminmean,maxvalue);
>     l->SetLineColor(38);
>     l->Draw();
> It works fine until I decide to change the Y coordinate to logarithmic 
> scale with
>     gPad->SetLogy();	
> 
> The line has an ofset (it's at 1 instead of 0) and goes off the histogram.
> What is wrong ?
> 
> I tried stuff like:
> l=new TLine(binminmean,log(0),binminmean,log(maxvalue));
> without success...
> if I put 1 instead of zero it starts at 10 if I put 2 it start at 100 
> etc..
> 
> I am using root 3.03.06
> 
> Cheers
> 
> 
> ------------------------------------------------------------
>  Reinhardt CHAMONAL            The University of Edinburgh  
>                                Dept. of Physics & Astronomy 
>  email: chamonal@ph.ed.ac.uk   King's Buildings, JCMB, 5301 
>                                Mayfield Road                
>  phone: +44-131-650 5307       Edinburgh, EH9 3JZ           
>  
>  web: http://www.ph.ed.ac.uk/~chamonal/
>       http://www.reuh.fr.st
> ------------------------------------------------------------
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:00 MET