TGraphPolar logarithmic radial axis?

Hi there,
Plotting the radial axis in log does not seem possible in TGraphPolar.
Could you please implement such a feature ?
Thanks in advance,
Z

You are right it is not yet implemented.

Hi Olivier,

Apparently the feature has been implemented in Root_5.21.04.
Thanks for that. :smiley:
Unfortunately, I cannot make it work.
Attached are the plots I get with and without “gPad->SetLogx()”.
With it, points are off-axis and the radial axis is not drawn.
Here’s the macro I’m using:

{
   Bool_t setlog = kTRUE ; 

   ///

   TF1 *f_rutherfordLike= new TF1("f_rutherfordLike","1./TMath::Power(TMath::Sin(x/2.),4)",0.,TMath::Pi()) ; 

   Int_t nPoints = 100 ; 
   Double_t *theta  = new Double_t [nPoints], *dtheta  = new Double_t [nPoints] ; 
   Double_t *radius = new Double_t [nPoints], *dradius = new Double_t [nPoints] ;
   for (int i=0; i<nPoints; i++) 
   {
      theta [i] = (i+1)*(TMath::Pi()/nPoints)      ; dtheta [i] = 0. ;
      radius[i] = f_rutherfordLike->Eval(theta[i]) ; dradius[i] = 0. ; 
      printf ("theta = %e rad (%e deg)  /  radius = %e \n",theta[i],theta[i]*TMath::RadToDeg(),radius[i]) ;
   } 
   printf ("\n") ;

   ///

   TCanvas *canvas_polar = new TCanvas("canvas_polar","TGraphPolar Example",600,600) ;
   if ( setlog ) { gPad->SetLogx() ; }

      TGraphPolar *graph = new TGraphPolar (nPoints, theta, radius, dtheta, dradius) ;
      graph->SetTitle("") ; graph->SetMarkerStyle(20) ; graph->SetMarkerColor(kRed) ; graph->SetMarkerSize(0.5) ;
      graph->Draw("P") ;
   
      canvas_polar->Update();
      graph->GetPolargram()->SetToDegree() ; 
      graph->GetPolargram()->SetLineColor(kGray) ; 
      graph->GetPolargram()->SetAxisAngle(-30) ;
      graph->GetPolargram()->SetRadialOffset(-0.02) ;
      graph->GetPolargram()->SetRangeRadial(1,10) ;

   canvas_polar->SaveAs(TString(Form("rutherford_polar_%s.gif",setlog?"log":"lin"))) ;
}

Thanks,
Z



What root version were you talking about initially ? nothing has change in that part since a long time.

An old one probably… :unamused:
Anyway, do you have any clue how could I fix this from Root_5.20.00 ?
Cheers, Z

When I told you it was not implemented I meant with the latest ROOT. Nothing has changed. There was an attempt made in the code (you can see if you look at it) but it never worked. So that is not just a matter of fixing a bug: it should be implemented.

OK, sorry for the misunderstanding.
So, back to the first post :

[quote]Could you please implement such a feature ? [/quote]Thanks, Z

Yes among many other things already on the list. If you feel you can do it faster than me I am willing to explain you where to look at.

Ok, I could give it a try. :confused:
Would it be posible you explain it in that post, in order that more skilled user could give it a try later if I don’t manage to make it.
Thanks, Z

You gave up with that one ? I saw you open a request in Savannah. Just curious …

The thing is I’m in the process of drawing up my PhD thesis and I’m running out of time.
I’m sure some people could solve this 10 times faster than me.
So yes, I let it to more skilled people, hoping this could be done by june.
This post is already 9 months old :cry:

Ok. We too have also more urgent things to do. But will have a look. I cannot promise a date.

Thanks Olivier.
Z