How to change radial pincers in Julia PyPlot polar plot?

Using julia and PyPlot (it looks like it calls matplotlib), I have a radial log plot ranging from 0dB at the outer edge of the plot to -50dB in the interior:

using PyPlot ;

theta = 0:0.02:1 * pi ;
n = length(theta) ;

U = cos( theta ).^2 ;
V = zeros( size(U) ) ;

for i = 1:n
   v = log10( U[i] ) ;
   if ( v < -50/10 )
      v = 0 ;
   else
      v = v/5 + 1 ;
   end

   V[i] = v ;
end

f1 = figure("p2Fig1",figsize=(10,10)) ; # Create a new figure
ax1 = axes( polar="true" ) ; # Create a polar axis

pl1 = plot( theta, V, linestyle="-", marker="None" ) ;

dtheta = 30 ;
ax1[:set_thetagrids]([0:dtheta:360-dtheta]) ;
ax1[:set_theta_zero_location]("E") ;
f1[:canvas][:draw]() ;

      

which looks like this:

polar

I would like to reset the polar pincers so that the radial marker markers are displayed from:

  • 1 → 0 dB
  • 0.8 → -10 dB
  • 0.6 → -20 dB
  • 0.4 -> -30 dB
  • 0.2 → -40 dB

How can I do that?

+3


source to share


1 answer


I've never used Julia, but you need to install shortcuts. I think this should do it:



ax1[:set_yticks]([0.2,0.4,0.6,0.8,1.0])
ax1[:set_yticklabels](["-40dB","-30dB","-20dB","-10dB","0dB"])

      

+6


source







All Articles