ck1987pd
ck1987pd

Reputation: 269

Is there a difference between pyplot Circle and patches Circle?

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.

Upvotes: 0

Views: 135

Answers (1)

aaossa
aaossa

Reputation: 3852

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

Upvotes: 1

Related Questions