my question is very similar to this question! but i want to use 1 circle to clip 2 triangles or more.
so i tried adding 2 triangles with add_patch
but it throws syntax error:
patchpoly = ax.add_patch(polygon1, polygon2)
so i know i can't go this way.
here is the code:
fig, ax = plt.subplots()
polygon1 = plt.Polygon([(0,0.6),(1,2),(2,0.4)],color='g',alpha=0.25)
polygon2 = plt.Polygon([(0,0),(1,0.5),(0.5,1)],color='b',alpha=0.25)
circle = plt.Circle((0,0), 1.0, color='r', alpha=0.25)
patchpoly = ax.add_patch(polygon1) # i know this line would be meaningless
patchpoly = ax.add_patch(polygon2)
ax.add_patch(circle)
patchpoly.set_clip_path(circle)
and the result: https://i.stack.imgur.com/URQEt.jpg