微调pcolor()极坐标图

时间:2014-11-06 09:50:42

标签: python heatmap polar-coordinates radial

我有一个属于径向和方位角坐标的64x360矩阵值。我想用两个图来形象化它们:笛卡儿和极地情节。 我用imshow()显示了笛卡尔坐标中的热图:

import numpy as np
import matplotlib.pyplot as plt

P=np.loadtxt('Pdata.csv')
print np.shape(P)
plt.imshow(P)
plt.xlabel('radius')
plt.ylabel('theta')
plt.show()

这给了我想要的情节: enter image description here

使用pcolor()时,极坐标中的相同图也非常直观:

r=np.arange(0,np.shape(P)[1],1)
t=np.arange(0,np.shape(P)[0],1)

R,T  = np.meshgrid(r,t)

fig = plt.figure()
ax = fig.add_subplot(111, polar = True)
ax.pcolor(T,R,P)   
plt.show()

然而,我对结果并不满意: enter image description here

情节的分辨率似乎非常有限,因此不可能区分具有更高强度和更低强度的角度,就像在笛卡尔图中一样。整个立体角似乎只分为六个或七个“蛋糕楔”。是否有一种简单和pythonic方式来增强角分辨率?

1 个答案:

答案 0 :(得分:0)

好的,我发现了一些东西。它适用于:

t = np.radians(np.linspace(0, np.shape(P)[0],np.shape(P)[0]))
r = np.arange(0, np.shape(P)[1], 1)

就像在这里看到的那样:Polar contour plot in matplotlib - best (modern) way to do it?

相关问题