From 14b80470719d45a4f2d65c7fb2c5aa866dc5d47a Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:27:54 +0200 Subject: [PATCH] MNT: Raise on GeoAxes limits manipulation GeoAxes does not support changing limits. We already raised on `set_x/ylim()`. This now also raises on `set_x/ybounds()` and `invert_x/yaxis()`. Closes #28590. --- lib/matplotlib/projections/geo.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/matplotlib/projections/geo.py b/lib/matplotlib/projections/geo.py index 498b2f72ebb4..89a9de7618be 100644 --- a/lib/matplotlib/projections/geo.py +++ b/lib/matplotlib/projections/geo.py @@ -151,6 +151,15 @@ def set_xlim(self, *args, **kwargs): "not supported. Please consider using Cartopy.") set_ylim = set_xlim + set_xbound = set_xlim + set_ybound = set_ylim + + def invert_xaxis(self): + """Not supported. Please consider using Cartopy.""" + raise TypeError("Changing axes limits of a geographic projection is " + "not supported. Please consider using Cartopy.") + + invert_yaxis = invert_xaxis def format_coord(self, lon, lat): """Return a format string formatting the coordinate."""