|
18 | 18 | from mpl_toolkits.axes_grid1.anchored_artists import (
|
19 | 19 | AnchoredSizeBar, AnchoredDirectionArrows)
|
20 | 20 | from mpl_toolkits.axes_grid1.axes_divider import (
|
21 |
| - Divider, HBoxDivider, make_axes_area_auto_adjustable) |
| 21 | + Divider, HBoxDivider, make_axes_area_auto_adjustable, SubplotDivider) |
22 | 22 | from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes
|
23 | 23 | from mpl_toolkits.axes_grid1.inset_locator import (
|
24 | 24 | zoomed_inset_axes, mark_inset, inset_axes, BboxConnectorPatch,
|
@@ -369,6 +369,40 @@ def test_axes_locatable_position():
|
369 | 369 | 0.03621495327102808)
|
370 | 370 |
|
371 | 371 |
|
| 372 | +@image_comparison(['image_grid_each_left_label_mode_all.png'], style='mpl20', |
| 373 | + savefig_kwarg={'bbox_inches': 'tight'}) |
| 374 | +def test_image_grid_each_left_label_mode_all(): |
| 375 | + imdata = np.arange(100).reshape((10, 10)) |
| 376 | + |
| 377 | + fig = plt.figure(1, (3, 3)) |
| 378 | + grid = ImageGrid(fig, (1, 1, 1), nrows_ncols=(3, 2), axes_pad=(0.5, 0.3), |
| 379 | + cbar_mode="each", cbar_location="left", cbar_size="15%", |
| 380 | + label_mode="all") |
| 381 | + # 3-tuple rect => SubplotDivider |
| 382 | + assert isinstance(grid.get_divider(), SubplotDivider) |
| 383 | + assert grid.get_axes_pad() == (0.5, 0.3) |
| 384 | + assert grid.get_aspect() # True by default for ImageGrid |
| 385 | + for ax, cax in zip(grid, grid.cbar_axes): |
| 386 | + im = ax.imshow(imdata, interpolation='none') |
| 387 | + cax.colorbar(im) |
| 388 | + |
| 389 | + |
| 390 | +@image_comparison(['image_grid_single_bottom_label_mode_1.png'], style='mpl20', |
| 391 | + savefig_kwarg={'bbox_inches': 'tight'}) |
| 392 | +def test_image_grid_single_bottom(): |
| 393 | + imdata = np.arange(100).reshape((10, 10)) |
| 394 | + |
| 395 | + fig = plt.figure(1, (2.5, 1.5)) |
| 396 | + grid = ImageGrid(fig, (0, 0, 1, 1), nrows_ncols=(1, 3), |
| 397 | + axes_pad=(0.2, 0.15), cbar_mode="single", |
| 398 | + cbar_location="bottom", cbar_size="10%", label_mode="1") |
| 399 | + # 4-tuple rect => Divider, isinstance will give True for SubplotDivider |
| 400 | + assert type(grid.get_divider()) is Divider |
| 401 | + for i in range(3): |
| 402 | + im = grid[i].imshow(imdata, interpolation='none') |
| 403 | + grid.cbar_axes[0].colorbar(im) |
| 404 | + |
| 405 | + |
372 | 406 | @image_comparison(['image_grid.png'],
|
373 | 407 | remove_text=True, style='mpl20',
|
374 | 408 | savefig_kwarg={'bbox_inches': 'tight'})
|
|
0 commit comments