clipping a triagle with a circle in matplotlib -


i draw triangle, 1 of sides needs circle segment. example not working: blue outside circle needs removed. can done directly, without calculating entire contour myself?

thank you!

import matplotlib.pyplot plt  fig = plt.figure() ax = fig.add_subplot(1, 1, 1) polygon = plt.polygon([(0,0.6),(1,2),(2,0.4)], true) circle=plt.circle((0,0),1.0,facecolor='none', edgecolor='black') ax.add_patch(polygon) ax.add_patch(circle)  plt.show() 

you can use set_clip_path property if capture added patch of polygon. given example:

fig = plt.figure() ax = fig.add_subplot(1, 1, 1)  polygon = plt.polygon([(0,0.6),(1,2),(2,0.4)], true) circle = plt.circle((0,0),1.0,facecolor='none', edgecolor='black')  patch_poly = ax.add_patch(polygon)     ax.add_patch(circle)  patch_poly.set_clip_path(circle) 

enter image description here


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -