Menu

[r7974]: / branches / mathtex / examples / api / clippath_demo.py  Maximize  Restore  History

Download this file

21 lines (13 with data), 375 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
"""
Clipping to arbitrary patches and paths
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.path as path
import matplotlib.patches as patches
fig = plt.figure()
ax = fig.add_subplot(111, frameon=False, xticks=[], yticks=[])
im = ax.imshow(np.random.rand(10,10))
patch = patches.Circle((300,300), radius=100)
im.set_clip_path(patch)
plt.show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.