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

Skip to content

Commit c37d9d6

Browse files
committed
TST: add a new test for placement
1 parent e720b63 commit c37d9d6

File tree

3 files changed

+192
-0
lines changed

3 files changed

+192
-0
lines changed
Binary file not shown.
Lines changed: 177 additions & 0 deletions
Loading

lib/matplotlib/tests/test_image.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,21 @@ def test_exact_vmin():
11561156
assert np.all(from_image == direct_computation)
11571157

11581158

1159+
@image_comparison(['image_placement'], extensions=['svg', 'pdf'],
1160+
remove_text=True, style='mpl20')
1161+
def test_image_placement():
1162+
"""
1163+
The red box should line up exactly with the outside of the image.
1164+
"""
1165+
fig, ax = plt.subplots()
1166+
ax.plot([0, 0, 1, 1, 0], [0, 1, 1, 0, 0], color='r', lw=0.4)
1167+
np.random.seed(19680801)
1168+
ax.imshow(np.random.randn(16, 16), cmap='Blues', extent=(0, 1, 0, 1),
1169+
interpolation='none', vmin=-1,vmax=1)
1170+
ax.set_xlim(-0.1, 1+0.1)
1171+
ax.set_ylim(-0.1, 1+0.1)
1172+
1173+
11591174
# A basic ndarray subclass that implements a quantity
11601175
# It does not implement an entire unit system or all quantity math.
11611176
# There is just enough implemented to test handling of ndarray

0 commit comments

Comments
 (0)