Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0ce489c

Browse files
committed
TST: add image grid test
1 parent8d5cac2 commit0ce489c

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

‎lib/matplotlib/tests/test_axes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5789,6 +5789,19 @@ def test_zoom_inset():
57895789
xx,rtol=1e-4)
57905790

57915791

5792+
deftest_set_position():
5793+
fig,ax=plt.subplots()
5794+
ax.set_aspect(3.)
5795+
ax.set_position([0.1,0.1,0.4,0.4],which='both')
5796+
assertnp.allclose(ax.get_position().width,0.1)
5797+
ax.set_aspect(2.)
5798+
ax.set_position([0.1,0.1,0.4,0.4],which='original')
5799+
assertnp.allclose(ax.get_position().width,0.15)
5800+
ax.set_aspect(3.)
5801+
ax.set_position([0.1,0.1,0.4,0.4],which='active')
5802+
assertnp.allclose(ax.get_position().width,0.1)
5803+
5804+
57925805
deftest_spines_properbbox_after_zoom():
57935806
fig,ax=plt.subplots()
57945807
bb=ax.spines['bottom'].get_window_extent(fig.canvas.get_renderer())

‎lib/mpl_toolkits/tests/test_axes_grid1.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
frommpl_toolkits.axes_grid1importhost_subplot
66
frommpl_toolkits.axes_grid1importmake_axes_locatable
77
frommpl_toolkits.axes_grid1importAxesGrid
8+
frommpl_toolkits.axes_grid1importImageGrid
89
frommpl_toolkits.axes_grid1.inset_locatorimport (
910
zoomed_inset_axes,
1011
mark_inset,
@@ -389,3 +390,19 @@ def test_axes_locatable_position():
389390
fig.canvas.draw()
390391
assertnp.isclose(cax.get_position(original=False).width,
391392
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+
deftest_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+
foriinrange(4):
407+
grid[i].imshow(im)
408+
grid[i].set_title('test {0}{0}'.format(i))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp