You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import matplotlib.pyplot as plt, numpy, matplotlib.patches as p
a=numpy.array([[1,2],[3,4]])
im=plt.imshow(a)
rect = p.Rectangle((0,0),1,1, transform=im.axes.transData)
circle = p.Circle((0,0),1, transform=im.axes.transData)
im.set_clip_path(circle)
im.set_clip_path(rect)
plt.show()
The text was updated successfully, but these errors were encountered:
I would like to clip a rectangular patch from an image, but my code below doesn't work. If I use a circle instead it works. It looks like a bug. Any help would be appreciated.
(See also http://matplotlib.org/examples/api/clippath_demo.html and http://matplotlib.1069221.n5.nabble.com/Clipping-td19613.html).
import matplotlib.pyplot as plt, numpy, matplotlib.patches as p
a=numpy.array([[1,2],[3,4]])
im=plt.imshow(a)
rect = p.Rectangle((0,0),1,1, transform=im.axes.transData)
circle = p.Circle((0,0),1, transform=im.axes.transData)
im.set_clip_path(circle)
im.set_clip_path(rect)
plt.show()
The text was updated successfully, but these errors were encountered: