From caa4745b00f294f1be7b6d0ae94a9320c57f3faf Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sun, 1 Oct 2023 20:21:08 +0100 Subject: [PATCH] Fix gridliner datalim updated by constrained layout --- lib/cartopy/mpl/geoaxes.py | 8 ++-- .../gridliner_constrained_adjust_datalim.png | Bin 0 -> 19716 bytes lib/cartopy/tests/mpl/test_gridliner.py | 35 ++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 lib/cartopy/tests/mpl/baseline_images/mpl/test_gridliner/gridliner_constrained_adjust_datalim.png diff --git a/lib/cartopy/mpl/geoaxes.py b/lib/cartopy/mpl/geoaxes.py index 535aa2924..b6f2cc70d 100644 --- a/lib/cartopy/mpl/geoaxes.py +++ b/lib/cartopy/mpl/geoaxes.py @@ -481,12 +481,14 @@ def _draw_preprocess(self, renderer): if self.get_autoscale_on() and self.ignore_existing_data_limits: self.autoscale_view() + # apply_aspect may change the x or y data limits, so must be called + # before the patch is updated. + self.apply_aspect() + # Adjust location of background patch so that new gridlines generated - # by `draw` or `get_tightbbox` are clipped correctly. + # by `draw` or `get_tightbbox` are positioned and clipped correctly. self.patch._adjust_location() - self.apply_aspect() - def get_tightbbox(self, renderer, *args, **kwargs): """ Extend the standard behaviour of diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_gridliner/gridliner_constrained_adjust_datalim.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_gridliner/gridliner_constrained_adjust_datalim.png new file mode 100644 index 0000000000000000000000000000000000000000..7dcacfbd93d0dbc4280bb72b6faac32738a9c54c GIT binary patch literal 19716 zcmb`vby!y2);)}gjRhv5f(i&Iib$gaEoVKK*qB%?cEr<|#VMIlB>LTU%QKidI zd+QxEm92AT21b|q-t&)L#(Ll5*+aXd8+=>ZA67ofda&JOqqNiB0LhZ=Jjt&@O_iQK z+L|Tu{-Z)j+2cb8EqJudicW2?dPON)m38j!k_K0+Bo~*>4(AS!W>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ccSj&tM`5*wZrvkzg-~H(9}f9b$7GYZY*ulY?X_nDw>hW$*q65v;( z5gl#{)_ut6-7d}=L;x{?Di%v(+hNmhr8Oa9)ZGwC%<=4za}RW3i%pPBj8ji8GS>lj zsq8iE?($prfxAwXQmexv-MT!MLN1G6N@y*%OmBbc>#H25>yyQjo)sHqu`J#s>Qe7+ znWyJ%Ibd(2m=Iin$6cU-OUwisAUV==@)U~-w~&@GH)ope6^2tT>Wux>QQ881r_;PY z7<07yz9qQ4N$(FkG)oEn^`NfeIbQ3+mRW}o73ZI>?Rn1X;|%qUCo_7I+lHmcQ79*5 Lj>jE4bM^lLTHTV> literal 0 HcmV?d00001 diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py index 92884cf36..c09f53010 100644 --- a/lib/cartopy/tests/mpl/test_gridliner.py +++ b/lib/cartopy/tests/mpl/test_gridliner.py @@ -7,6 +7,7 @@ import io from unittest import mock +from matplotlib.collections import PolyCollection import matplotlib.pyplot as plt import matplotlib.ticker as mticker import numpy as np @@ -257,6 +258,40 @@ def test_grid_labels_tight(): return fig +@pytest.mark.mpl_image_compare( + filename='gridliner_constrained_adjust_datalim.png', + tolerance=grid_label_tol) +def test_gridliner_constrained_adjust_datalim(): + fig = plt.figure(figsize=(8, 4), layout="constrained") + + # Make some axes that will fill the available space while maintaining + # correct aspect ratio + ax = fig.add_subplot(projection=ccrs.PlateCarree()) + ax.set_aspect(aspect='equal', adjustable='datalim') + + # Add some polygon to the map, with a colour bar + collection = PolyCollection( + verts=[ + [[0, 0], [1, 0], [1, 1], [0, 1]], + [[1, 0], [2, 0], [2, 1], [1, 1]], + [[0, 1], [1, 1], [1, 2], [0, 2]], + [[1, 1], [2, 1], [2, 2], [1, 2]], + ], + array=[1, 2, 3, 4], + ) + ax.add_collection(collection) + fig.colorbar(collection, ax=ax, location='right') + + # Set up the axes data limits to keep the polygon in view + ax.autoscale() + + # Add some gridlines + ax.gridlines(draw_labels=["bottom", "left"], auto_update=True, + linestyle="-") + + return fig + + @pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug") @pytest.mark.natural_earth @pytest.mark.parametrize('proj', TEST_PROJS)