Skip to content

Commit 5adb516

Browse files
authored
Merge pull request #12791 from meeseeksmachine/auto-backport-of-pr-12790-on-v3.0.x
Backport PR #12790 on branch v3.0.x (Remove ticks and titles from tight bbox tests.)
2 parents 1468456 + 21e175c commit 5adb516

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
import warnings
1616

1717
import matplotlib
18-
from matplotlib.testing.decorators import image_comparison, check_figures_equal
18+
from matplotlib.testing.decorators import (
19+
image_comparison, check_figures_equal, remove_ticks_and_titles)
1920
import matplotlib.pyplot as plt
2021
import matplotlib.markers as mmarkers
2122
import matplotlib.patches as mpatches
@@ -5845,9 +5846,10 @@ class DummySubplot(matplotlib.axes.SubplotBase, Dummy):
58455846

58465847
def test_gettightbbox_ignoreNaN():
58475848
fig, ax = plt.subplots()
5849+
remove_ticks_and_titles(fig)
58485850
t = ax.text(np.NaN, 1, 'Boo')
58495851
renderer = fig.canvas.get_renderer()
5850-
np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 532.444444)
5852+
np.testing.assert_allclose(ax.get_tightbbox(renderer).width, 496)
58515853

58525854

58535855
def test_scatter_series_non_zero_index(pd):

lib/mpl_toolkits/tests/test_axes_grid1.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import matplotlib
22
import matplotlib.pyplot as plt
3-
from matplotlib.testing.decorators import image_comparison
3+
from matplotlib.testing.decorators import (
4+
image_comparison, remove_ticks_and_titles)
45

56
from mpl_toolkits.axes_grid1 import host_subplot
67
from mpl_toolkits.axes_grid1 import make_axes_locatable
@@ -410,7 +411,6 @@ def test_image_grid():
410411

411412

412413
def test_gettightbbox():
413-
414414
fig, ax = plt.subplots(figsize=(8, 6))
415415

416416
l, = ax.plot([1, 2, 3], [0, 1, 0])
@@ -419,6 +419,8 @@ def test_gettightbbox():
419419
ax_zoom.plot([1, 2, 3], [0, 1, 0])
420420

421421
mark_inset(ax, ax_zoom, loc1=1, loc2=3, fc="none", ec='0.3')
422+
423+
remove_ticks_and_titles(fig)
422424
bbox = fig.get_tightbbox(fig.canvas.get_renderer())
423425
np.testing.assert_array_almost_equal(bbox.extents,
424-
[-18.022743, -14.118056, 7.332813, 5.4625])
426+
[-17.7, -13.9, 7.2, 5.4])

0 commit comments

Comments
 (0)