多亏了这个非常有用的post,我终于想出了如何制作一个充满极坐标的等高线图。然而,当我进入下一步并试图在同一个图中添加一个散点时,我遇到了一些问题。原稿如下:
import numpy as np
import matplotlib.pyplot as plt
#-- Generate Data -----------------------------------------
# Using linspace so that the endpoint of 360 is included...
azimuths = np.radians(np.linspace(0, 360, 20))
zeniths = np.arange(0, 70, 10)
r, theta = np.meshgrid(zeniths, azimuths)
values = np.random.random((azimuths.size, zeniths.size))
#-- Plot... ------------------------------------------------
fig, ax = plt.subplots(subplot_kw=dict(projection='polar'))
ax.contourf(theta, r, values)
plt.show()
它产生了这样的形象:
如果我还添加散点图:
^{pr2}$取而代之的是这个图像:
为什么我得到填充轮廓和轴之间的厚白色边界?我怎样才能摆脱它?在
非常感谢!在
抱歉,两分钟后,有人问我问题,我才想到答案。我刚刚意识到添加散点图会改变轴的限制。将轴强制到所需的间隔可解决问题。在
我想我可以把这个问题留着不管怎样,它仍然可以对其他用户有所帮助。在
相关问题 更多 >
编程相关推荐