8000 Backport PR #12790 on branch v3.0.x (Remove ticks and titles from tight bbox tests.) by meeseeksmachine · Pull Request #12791 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #12790 on branch v3.0.x (Remove ticks and titles from tight bbox tests.) #12791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
8 changes: 5 additions & 3 deletions lib/mpl_toolkits/tests/test_axes_grid1.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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])
Expand All @@ -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])
0