使用 julia 和 PyPlot(看起来它称为 matplotlib)我得到了一个径向对数图,范围从图外边缘的 0dB 到内部的 -50dB:
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]() ;
看起来像:
我想重置极地刻度,以便径向刻度标记映射自:
- 1 -> 0 分贝
- 0.8 -> -10 分贝
- 0.6 -> -20 分贝
- 0.4 -> -30 分贝
- 0.2 -> -40 分贝
如何实现?
最佳答案
我从未使用过 Julia,但您需要设置 yticklabels。我认为应该这样做:
ax1[:set_yticks]([0.2,0.4,0.6,0.8,1.0])
ax1[:set_yticklabels](["-40dB","-30dB","-20dB","-10dB","0dB"])
关于python - 如何更改 julia PyPlot 极坐标图中的径向刻度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29921611/