Issue
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])
So far so good. But, what I only want a portion of the circle? For example, something that looks like this.
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?
Solution
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:
output on top of the original circle:
Answered By - mozway
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.