我有一些制作极坐标图的示例代码:
import numpy as np
import matplotlib.pyplot as plt
azimuths = np.radians(np.linspace(0, 180, 90))
zeniths = np.arange(50, 5050, 50)
r, theta = np.meshgrid(zeniths, azimuths)
values = 90.0+5.0*np.random.random((len(azimuths), len(zeniths)))
fig, ax = plt.subplots(subplot_kw=dict(projection='polar'))
ax.set_theta_zero_location("W")
pp = plt.contourf(theta, r, values, label='tmp')
cbar = plt.colorbar(pp, orientation='vertical')
cbar.ax.set_ylabel('scale label')
plt.show()
给我的感觉是:
……但我更喜欢这样:
…中间有空间,只显示0到180度。有人知道有什么方便的方法吗?在
我不确定这有多方便,但这里有一个可破解的解决方案(取自here):
请注意(为了获得原点附近的空间),您需要将所有数据点沿半径方向移动1000,并在θ方向移动pi(以获得下半球)。 这就产生了:
相关问题 更多 >
编程相关推荐