目前,我有以下脚本可生成方位角/半径数据的极坐标图。“ R1”是从ArcGIS中的表格派生的[方位角,倾角]值的简单列表。
import matplotlib.pyplot as plt
import numpy as np
for(a,r) in R1:
angles.append(a)
radius.append(90-r)
theta = np.radians(angles)
r = radius
ax = plt.subplot(111,polar=True)
ax.plot(theta, r, color='black', ls='-', linewidth=1)
ax.fill(theta,r,'0.75') ## should I use ax.fill_betweenx() ?
ax.set_theta_zero_location('N')
ax.set_theta_direction(-1)
ax.set_rmax(90)
ax.set_rmin(0)
ax.set_yticks(range(0,90,10))
yLabel=['90','','','60','','','30','','','']
ax.set_yticklabels(yLabel)
ax.grid(True)
plt.show()
目前,这将创建以下图:
我如何“反转”填充,以便用灰色填充的将是白色,而白色则将是灰色?
我已经尝试过ax.fill_betweenx(theta,90,r,color ='0.75'),但是没有用。我已经为此奋斗了一段时间,但毫无结果。
任何帮助或建议,我们将不胜感激!
如果有什么办法可以让我说得更清楚,请在评论中让我知道。
根据您稍后要执行的操作,最快的方法是简单地将背景设为灰色,将填充设为白色:
import matplotlib.pyplot as plt
import numpy as np
ax = plt.subplot(111, polar=True)
theta = np.linspace(0, 2*np.pi, 100)
r = 2 + np.sin(theta * 2)
ax.patch.set_facecolor('0.5')
ax.plot(theta, r, color='black', ls='-', linewidth=1)
ax.fill(theta,r,'w')
plt.show()
plt.draw() # just to be safe!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句