|
5 | 5 | from mpl_toolkits.axes_grid1 import host_subplot
|
6 | 6 | from mpl_toolkits.axes_grid1 import make_axes_locatable
|
7 | 7 | from mpl_toolkits.axes_grid1 import AxesGrid
|
| 8 | +from mpl_toolkits.axes_grid1 import ImageGrid |
8 | 9 | from mpl_toolkits.axes_grid1.inset_locator import (
|
9 | 10 | zoomed_inset_axes,
|
10 | 11 | mark_inset,
|
@@ -380,3 +381,28 @@ def test_anchored_direction_arrows_many_args():
|
380 | 381 | sep_x=-0.06, sep_y=-0.08, back_length=0.1, head_width=9,
|
381 | 382 | head_length=10, tail_width=5)
|
382 | 383 | ax.add_artist(direction_arrows)
|
| 384 | + |
| 385 | + |
| 386 | +def test_axes_locatable_position(): |
| 387 | + fig, ax = plt.subplots() |
| 388 | + divider = make_axes_locatable(ax) |
| 389 | + cax = divider.append_axes('right', size='5%', pad='2%') |
| 390 | + fig.canvas.draw() |
| 391 | + assert np.isclose(cax.get_position(original=False).width, |
| 392 | + 0.03621495327102808) |
| 393 | + |
| 394 | + |
| 395 | +@image_comparison(baseline_images=['image_grid'], extensions=['png'], |
| 396 | + remove_text=True, style='mpl20', |
| 397 | + savefig_kwarg={'bbox_inches': 'tight'}) |
| 398 | +def test_image_grid(): |
| 399 | + # test that image grid works with bbox_inches=tight. |
| 400 | + im = np.arange(100) |
| 401 | + im.shape = 10, 10 |
| 402 | + |
| 403 | + fig = plt.figure(1, (4., 4.)) |
| 404 | + grid = ImageGrid(fig, 111, nrows_ncols=(2, 2), axes_pad=0.1) |
| 405 | + |
| 406 | + for i in range(4): |
| 407 | + grid[i].imshow(im) |
| 408 | + grid[i].set_title('test {0}{0}'.format(i)) |
0 commit comments