如何绘制带阴影的三分之四圆或弧

0 投票
1 回答
37 浏览
提问于 2025-04-14 17:09

可以用 matplotlib.patches 来画一个带有斜线填充的三分之四圆吗(如下图所示)?

这里插入图片描述

我试过了,结果是这样的:

这里插入图片描述

1 个回答

2

你没有展示你的代码(你应该编辑你的问题,把你的尝试加上),不过用 matplotlib.patches.Wedge 来实现这个功能其实很简单。

import matplotlib.pyplot as plt
from matplotlib.patches import Wedge

fig, ax = plt.subplots()
w = Wedge((0,0), 10, 90, 360, fill=False, hatch="\\", edgecolor="tab:green")
ax.add_patch(w)
ax.autoscale_view()
ax.set_aspect(1)
fig.show()

撰写回答