Python 如何在极坐标图中填充3条直线?

Python 如何在极坐标图中填充3条直线?,python,matplotlib,polar-coordinates,Python,Matplotlib,Polar Coordinates,我在极坐标图中画了一个圆和两条直线,我想在它们之间填充(圆的四分之一)。但我不知道怎么做 您需要稍微修改代码以包含要绘制的区域,n使用fill\u-between方法。在第一象限的特定情况下,我们必须填充0-90度和0-1半径之间的距离。守则: import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, polar=True) theta1 = np.lins

我在极坐标图中画了一个圆和两条直线,我想在它们之间填充(圆的四分之一)。但我不知道怎么做


您需要稍微修改代码以包含要绘制的区域,n使用
fill\u-between
方法。在第一象限的特定情况下,我们必须填充
0-90
度和
0-1
半径之间的距离。守则:

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111, polar=True)

theta1 = np.linspace(0, 2 * np.pi, 100)
r1 = theta1 * 0 + 1
ax.plot(theta1, r1, color='b')

theta2 = np.array([np.pi / 2] * 100)
r2 = np.linspace(0, 1, 100)
ax.plot(theta2, r2, color='b')

theta3 = np.array([0] * 100)
r3 = np.linspace(0, 1, 100)
ax.plot(theta3, r3, color='b')

theta4 = np.linspace(0, np.pi / 2, 100)
ax.fill_between(theta4, 0, 1)

plt.show()
将绘制:

请提供完整的可执行程序。对不起,我忘了复制粘贴导入谢谢!这正是我要找的!
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111, polar=True)

theta1 = np.linspace(0, 2 * np.pi, 100)
r1 = theta1 * 0 + 1
ax.plot(theta1, r1, color='b')

theta2 = np.array([np.pi / 2] * 100)
r2 = np.linspace(0, 1, 100)
ax.plot(theta2, r2, color='b')

theta3 = np.array([0] * 100)
r3 = np.linspace(0, 1, 100)
ax.plot(theta3, r3, color='b')

theta4 = np.linspace(0, np.pi / 2, 100)
ax.fill_between(theta4, 0, 1)

plt.show()