Python 3.x 极坐标热图

Python 3.x 极坐标热图,python-3.x,pandas,matplotlib,heatmap,polar-coordinates,Python 3.x,Pandas,Matplotlib,Heatmap,Polar Coordinates,我有一个3列的DF(θ、半径和值), 每列长度为6000。所有列都是独立的,因此这些值在θ或半径中不起作用 我需要在极坐标圆上画一张热图 我试过这个: r, theta=np.meshgrid(DF['R'],DF['theta']) fig, ax= plt.subplots(subplot_kw=dict(projection='polar')) ax.set_theta_zero_location("N") ax.set_theta_direction(-1) cax=

我有一个3列的DF(θ、半径和值), 每列长度为6000。所有列都是独立的,因此这些值在θ或半径中不起作用

我需要在极坐标圆上画一张热图

我试过这个:

r, theta=np.meshgrid(DF['R'],DF['theta'])
fig, ax= plt.subplots(subplot_kw=dict(projection='polar'))
ax.set_theta_zero_location("N")
ax.set_theta_direction(-1)
cax=ax.contourf(theta, r, DF['values'])
但有一个错误:

TypeError: Input z must be a 2D array.

任何帮助

我不确定您的确切问题是什么,但我认为简单的搜索可以得到一些现成的答案:在我的问题中,Z是独立的。。。它是dataframe中的一列。。。似乎在它的维度上有一个我没有理解的问题。