diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 629517406799..c0e0e560d76a 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -15,7 +15,8 @@ import warnings import matplotlib -from matplotlib.testing.decorators import image_comparison, check_figures_equal +from matplotlib.testing.decorators import ( + image_comparison, check_figures_equal, remove_ticks_and_titles) import matplotlib.pyplot as plt import matplotlib.markers as mmarkers import matplotlib.patches as mpatches @@ -5845,9 +5846,10 @@ class DummySubplot(matplotlib.axes.SubplotBase, Dummy): def test_gettightbbox_ignoreNaN(): fig, ax = plt.subplots() + remove_ticks_and_titles(fig) t = ax.text(np.NaN, 1, 'Boo') renderer = fig.canvas.get_renderer() - np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 532.444444) + np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 496) def test_scatter_series_non_zero_index(pd): diff --git a/lib/mpl_toolkits/tests/test_axes_grid1.py b/lib/mpl_toolkits/tests/test_axes_grid1.py index f1ededf67203..ddbf7e9f7c07 100644 --- a/lib/mpl_toolkits/tests/test_axes_grid1.py +++ b/lib/mpl_toolkits/tests/test_axes_grid1.py @@ -1,6 +1,7 @@ import matplotlib import matplotlib.pyplot as plt -from matplotlib.testing.decorators import image_comparison +from matplotlib.testing.decorators import ( + image_comparison, remove_ticks_and_titles) from mpl_toolkits.axes_grid1 import host_subplot from mpl_toolkits.axes_grid1 import make_axes_locatable @@ -410,7 +411,6 @@ def test_image_grid(): def test_gettightbbox(): - fig, ax = plt.subplots(figsize=(8, 6)) l, = ax.plot([1, 2, 3], [0, 1, 0]) @@ -419,6 +419,8 @@ def test_gettightbbox(): ax_zoom.plot([1, 2, 3], [0, 1, 0]) mark_inset(ax, ax_zoom, loc1=1, loc2=3, fc="none", ec='0.3') + + remove_ticks_and_titles(fig) bbox = fig.get_tightbbox(fig.canvas.get_renderer()) np.testing.assert_array_almost_equal(bbox.extents, - [-18.022743, -14.118056, 7.332813, 5.4625]) + [-17.7, -13.9, 7.2, 5.4])