pyplot Circle和patch Circle有区别吗?

Is there a difference between pyplot Circle and patches Circle?

我试图查看 documentation,但我在其中找不到 matplotlib.Circle。我还检查了 matplotlib.patches.circle 并没有看到任何说 matplotlib.Circle 是 matplotlib.patches.circle.

的占位符

它们的运作方式不同吗?

谢谢。

编辑:忘记了plt是matplotlib.pyplot的一个很常见的缩写,而不是matplotlib本身,所以才出现了这个问题。

我猜你指的是 matplotlib.pyplot.Circlematplotlib.patches.Circle。快速检查:

>>> import matplotlib
>>> matplotlib.patches.Circle is matplotlib.pyplot.Circle
True

这意味着两个类是同一个对象。发生这种情况是因为 matplotlib.pyplotmatplotlib.patches (source code at GitHub) 导入 Circle:

# Line 76 at matplotlib/pyplot.py (tag "v3.5.1")
from matplotlib.patches import Polygon, Rectangle, Circle, Arrow