簡體   English   中英

如何改變朱莉婭PyPlot極坐標圖中的徑向刻度?

[英]How to change radial ticks in julia PyPlot polar plot?

使用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 dB
  • 0.8 - > -10 dB
  • 0.6 - > -20 dB
  • 0.4 - > -30 dB
  • 0.2 - > -40 dB

如何實現這一目標?

我從未使用過朱莉婭,但你需要設置yticklabels。 我認為應該這樣做:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM