diff --git a/lib/cartopy/mpl/geoaxes.py b/lib/cartopy/mpl/geoaxes.py index d63d7150f..d603226e5 100644 --- a/lib/cartopy/mpl/geoaxes.py +++ b/lib/cartopy/mpl/geoaxes.py @@ -1314,7 +1314,21 @@ def imshow(self, img, *args, **kwargs): raise ValueError('Expected a projection subclass. Cannot ' 'handle a %s in imshow.' % type(transform)) - target_extent = self.get_extent(self.projection) + # |target_extent| is the area the image will cover in + # target projection coordinates. This affects the + # resolution of the rescaled image. + if extent is None: + # This assumes it will cover the current visible area. + target_extent = self.get_extent(self.projection) + else: + box = sgeom.box(extent[0], extent[2], extent[1], extent[3]) + target_geometry = transform.project_geometry(box, + self.projection) + target_extent = (target_geometry.bounds[0], + target_geometry.bounds[2], + target_geometry.bounds[1], + target_geometry.bounds[3]) + regrid_shape = kwargs.pop('regrid_shape', 750) regrid_shape = self._regrid_shape_aspect(regrid_shape, target_extent)