8000 im.set_clip_path(rectangle) doesn't work · Issue #1733 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
im.set_clip_path(rectangle) doesn't work #1733
Closed
@fkbreitl

Description

@fkbreitl

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()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0