2015-04-28 80 views
3

使用朱莉娅和PyPlot(看起来像它调用matplotlib)我有一个径向数图,从0分贝对剧情的外缘到-50dB的内部:如何更改茱莉亚PyPlot极坐标图中的径向刻度?

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]() ; 

,看起来像:

polar

我想复位极性蜱使得径向记号标记物选自映射:

  • 1 - > 0分贝
  • 0.8 - > -10分贝
  • 0.6 - > -20分贝
  • 0.4 - > -30分贝
  • 0.2 - > -40分贝

如何可能?

回答

6

我从来没有使用过朱莉娅,但你需要设置yticklabels。我认为这应该这样做:

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