簡體   English   中英

Matplotlib極地輪廓線圖:在theta原點連續

[英]Matplotlib polar contourf plot: continuous across theta origin

我有E格式的數據( freqtheta ),其中E是2D數組, freqtheta是1D數組。

以下代碼部分產生了附圖。 但是,我想使輪廓圖在0度原點連續(即,沿着0方位沒有空白楔形)。

我瀏覽了matplotlib文檔,並廣泛地發布了問題,似乎找不到解決此問題的方法。 有任何想法嗎?

碼:

[r, th] = np.meshgrid(freq,theta)

fig = plt.figure()
ax = fig.add_subplot(111, polar=True)
ax.set_theta_zero_location('N')
ax.set_theta_direction(-1)

cntf = ax.contourf(th,r,np.log10(E),cmap='jet',extend='both',
    levels=np.linspace(np.mean(np.log10(E)), np.amax(np.log10(E)), 15))

ax.set_rlim(0, .3)
label_position=ax.get_rlabel_position()
ax.text(np.radians(label_position+25),ax.get_rmax()/1.5,'f (Hz)',
        rotation=label_position,ha='center',va='center')

產生的情節: 定向波譜

類似於以下內容: https : //stackoverflow.com/a/22129714/9324652

在此處輸入圖片說明

dtheta = np.diff(theta).mean()
wrp_theta = np.concatenate((theta, theta[-1:] + dtheta))
wrp_E = np.concatenate((E, E[0:1, :]), axis=0)

暫無
暫無

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

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