Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions examples/images_contours_and_fields/image_demo.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""
Simple demo of the imshow function.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook

image_file = cbook.get_sample_data('lena.npy')
image = np.load(image_file)
image_file = cbook.get_sample_data('ada.png')
image = plt.imread(image_file)

plt.imshow(image)
plt.axis('off') # clear x- and y-axes
Expand Down
7 changes: 3 additions & 4 deletions examples/images_contours_and_fields/image_demo_clip_path.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
"""
Demo of image that's been clipped by a circular patch.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.cbook as cbook


image_file = cbook.get_sample_data('lena.npy')
image = np.load(image_file)
image_file = cbook.get_sample_data('grace_hopper.png')
image = plt.imread(image_file)

fig, ax = plt.subplots()
im = ax.imshow(image)
patch = patches.Circle((130, 130), radius=100, transform=ax.transData)
patch = patches.Circle((260, 200), radius=200, transform=ax.transData)
im.set_clip_path(patch)

plt.axis('off')
Expand Down
Binary file removed lib/matplotlib/mpl-data/sample_data/lena.npy
Binary file not shown.