From 178684c881c2d6265b42a7dc6f91b9bc274fb861 Mon Sep 17 00:00:00 2001 From: Ruth Comer Date: Wed, 4 Oct 2023 18:28:56 +0100 Subject: [PATCH] Fix constrained layout padding pre mpl v3.6 --- lib/cartopy/tests/mpl/test_gridliner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py index 92884cf36..474820b54 100644 --- a/lib/cartopy/tests/mpl/test_gridliner.py +++ b/lib/cartopy/tests/mpl/test_gridliner.py @@ -14,6 +14,7 @@ from shapely.geos import geos_version import cartopy.crs as ccrs +from cartopy.mpl import _MPL_36 from cartopy.mpl.geoaxes import GeoAxes from cartopy.mpl.gridliner import (LATITUDE_FORMATTER, LONGITUDE_FORMATTER, Gridliner, classic_formatter, @@ -497,7 +498,10 @@ def test_gridliner_title_adjust(): plt.rcParams['axes.titley'] = None fig = plt.figure(layout='constrained') - fig.get_layout_engine().set(h_pad=1/8) + if _MPL_36: + fig.get_layout_engine().set(h_pad=1/8) + else: + fig.set_constrained_layout_pads(h_pad=1/8) for n, proj in enumerate(projs, 1): ax = fig.add_subplot(2, 2, n, projection=proj) ax.coastlines()