2

I can draw a full circle like so:

plt.figure()
ax = plt.gca()

# Make the circle patch and add to the figure
circle = plt.Circle((1, 0), 1, color='r', fill=None)
ax.add_patch(circle)
    
# Make it a perfect circle by making it a perfect square box
ax.set_aspect('equal', adjustable='box')
    
# Set axis so it's visible 
plt.xlim([-0.5,2.5])    
plt.ylim([-1.5, 1.5])  

enter image description here

So far so good. But, what I only want a portion of the circle? For example, something that looks like this.

enter image description here

I could just plot something on top of it with the same color as the background, but that seems a little hacky. Is there a better way?

1
  • 1
    A partial circle is an arc. You just need to draw an arc instead of a circle Commented Jun 29, 2022 at 7:44

1 Answer 1

2

What about using an Arc?

from matplotlib.patches import Arc
radius = 1
arc = Arc((1, 0), radius*2, radius*2, color='b', theta1=90, theta2=360)
ax.add_patch(arc)

output:

enter image description here

output on top of the original circle:

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Ahh, that's perfect! This is actually what I want. I must have missed it in the docs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.