Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f7c013

Browse files
committed
Cleanup and move clippath_demo
1 parent 6acc43a commit 7f7c013

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

examples/api/clippath_demo.py

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
Demo of image that's been clipped by a circular patch.
3+
"""
4+
import numpy as np
5+
import matplotlib.pyplot as plt
6+
import matplotlib.patches as patches
7+
import matplotlib.cbook as cbook
8+
9+
10+
image_file = cbook.get_sample_data('lena.npy')
11+
image = np.load(image_file)
12+
13+
fig, ax = plt.subplots()
14+
im = ax.imshow(image)
15+
patch = patches.Circle((130, 130), radius=100, transform=ax.transData)
16+
im.set_clip_path(patch)
17+
18+
plt.axis('off')
19+
plt.show()

0 commit comments

Comments
 (0)