Re: [ROOT] problem with a graph in y-log scale

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jul 18 2003 - 17:40:00 MEST


Benoit,

If you are setting:
      fCanvas->SetLogy(1);
and in addition computing y with
      tgraph->SetPoint(i,x[i],fabs(log10(y[i])));

you define a log(log) scale ! I am not sure that it is what you want!

Rene Brun


Benoit Revenu wrote:
> 
> Hi rooters,
> 
> I'm trying to do something like :
> 
> fCanvas->SetLogy(1);
> for(i=0;i<dim;i++)
>     {
>       tgraph->SetPoint(i,x[i],fabs(log10(y[i])));
>       tgraph->SetPointError(i,0,fabs(log10(sqrt(y[i]))));
>     }
> fCanvas->DrawFrame(rxmin,        // xmin
>                    log10(rymin), // ymin
>                    rxmax,        // xmax
>                    log10(rymax)  // ymax
>                   );
> for( unsigned int i=0;i<nmax;i++ )
>     {
>       dist = fLDF[i][0];
>       sig =  fLDF[i][1];
>       tgraphLDF0->SetPoint(i,dist,log10(sig));
>     }
> 
>   tgraph->GetXaxis()->SetTitle("Distance to axis (m)");
>   tgraph->GetYaxis()->SetTitle("Tank signal (VEM)");
>   tgraph->Draw("P");
>   tgraphLDF0->Draw("L");
>   fText.SetTextSize(0.04);
>   fText.SetTextAlign(22);
>   fText.SetNDC(kFalse);
>   for( int i=0;i<dim;i++ )
>     {
>       fText.DrawText(x[i],log10(log10(1.5*y[i])),"toto");
>     }
>   fCanvas->Update();
>   sprintf(name,"signal_%d",fSdEvent->fEventNumber);
>   if( fIsBatch ) SaveCanvas(name,BATCH);
>   else SaveCanvas(name,DEFAULT);
>   fCanvas->SetLogy(0); // reset to linear scale
> 
> this code works well in the sense I get what I wanted but I'm very
> surprised to have to use log10(log10(...)) for the text to be correctly
> displayed...
> 
> fText.DrawText(x[i],log10(log10(1.5*y[i])),"toto");
> 
> Maybe I'm doing something wrong in the principle from the beginning ???



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