Home > Net >  Is there a difference between pyplot Circle and patches Circle?
Is there a difference between pyplot Circle and patches Circle?

Time:03-02

I tried to check the documentation, but I couldn't find matplotlib.Circle in it. I also checked matplotlib.patches.circle and couldn't see anything saying that matplotlib.Circle is a place holder of matplotlib.patches.circle.

Do they operate differently?

Thank you.

Edit: I forgot that plt is a very common abbreviation for matplotlib.pyplot rather than matplotlib itself, which resulted in this question.

CodePudding user response:

I guess you're referring to matplotlib.pyplot.Circle and matplotlib.patches.Circle. A quick check:

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

This means that both classes are the same object. This happens because matplotlib.pyplot imports Circle from matplotlib.patches (source code at GitHub):

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