擅长:python、mysql、java
<p>在matplotlib 2.1或更高版本中,可以执行以下操作。matplotlib页上还有<a href="https://matplotlib.org/gallery/pie_and_polar_charts/polar_scatter.html#scatter-plot-on-polar-axis-confined-to-a-sector" rel="noreferrer">an example</a>。<br/>
可以使用通常的极坐标图<code>ax = fig.add_subplot(111, polar=True)</code>,并限制θ范围。对于<strong>半极坐标图</p>
<pre><code>ax.set_thetamin(0)
ax.set_thetamax(180)
</code></pre>
<p>或对于<strong>四分之一极坐标图</p>
<pre><code>ax.set_thetamin(0)
ax.set_thetamax(90)
</code></pre>
<p>完整示例:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
theta = np.linspace(0,np.pi)
r = np.sin(theta)
fig = plt.figure()
ax = fig.add_subplot(111, polar=True)
c = ax.scatter(theta, r, c=r, s=10, cmap='hsv', alpha=0.75)
ax.set_thetamin(0)
ax.set_thetamax(180)
plt.show()
</code></pre>
<p><a href="https://i.stack.imgur.com/BwBG7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BwBG7.png" alt="enter image description here"/></a></p>