【发布时间】:2016-10-30 09:47:37
【问题描述】:
从一组角度 (theta) 和半径 (r) 我使用 matplotlib 绘制了一个散点图:
fig = plt.figure()
ax = plt.subplot(111, polar=True)
ax.scatter(theta, r, color='None', edgecolor='red')
ax.set_rmax(1)
plt.savefig("polar.eps",bbox_inches='tight')
我现在想在上面绘制密度等高线图,所以我尝试了:
fig = plt.figure()
ax = plt.subplot(111, polar=True)
H, theta_edges, r_edges = np.histogram2d(theta, r)
cax = ax.contourf(theta_edges[:-1], r_edges[:-1], H, 10, cmap=plt.cm.Spectral)
ax.set_rmax(1)
plt.savefig("polar.eps",bbox_inches='tight')
Which gave me the following results that is obviously not what I wanted to do.
我做错了什么?
【问题讨论】:
-
您能否举例说明密度等高线图的外观,对不起,我不是图形专家。
-
这是一个图形,表示给定区域内点的平均密度,等高线划分不同密度的区域:i.stack.imgur.com/XJYnz.png
-
为了得到类似的东西,你必须使用 pcolor 而不是 contourf?
-
我都试过了,这并没有改变我的极坐标问题。
标签: python matplotlib polar-coordinates