code: def test_extents():
      # tests that one can set the extents of a map in a variety of coordinate
      # systems, for a variety of projection
      uk = [-12.5, 4, 49, 60]
      uk_crs = ccrs.Geodetic()
  
      ax = plt.axes(projection=ccrs.PlateCarree(), label="pc")
      ax.set_extent(uk, crs=uk_crs)
      # enable to see what is going on (and to make sure it is a plot of the uk)
      # ax.coastlines()
      assert_array_almost_equal(
          ax.viewLim.get_points(),
          np.array([[-12.5, 49.0], [4.0, 60.0]]),
      )
  
      ax = plt.axes(projection=ccrs.NorthPolarStereo(), label="npstere")
      ax.set_extent(uk, crs=uk_crs)
      # enable to see what is going on (and to make sure it is a plot of the uk)
      # ax.coastlines()
      assert_array_almost_equal(
          ax.viewLim.get_points(),
          np.array(
              [
                  [-1034046.22566261, -4765889.76601514],
                  [333263.47741164, -3345219.0594531],
              ]
          ),
      )
  
      # given that we know the PolarStereo coordinates of the UK, try using
      # those in a PlateCarree plot
      ax = plt.axes(projection=ccrs.PlateCarree(), label="pc")
      ax.set_extent(
          [-1034046, 333263, -4765889, -3345219],
          crs=ccrs.NorthPolarStereo(),
      )
      # enable to see what is going on (and to make sure it is a plot of the uk)
      # ax.coastlines()
      assert_array_almost_equal(
          ax.viewLim.get_points(),
          np.array(
              [[-17.17698577, 48.21879707], [5.68924381, 60.54218893]]
          ),
      )
  
file_path: cartopy/lib/cartopy/tests/mpl/test_set_extent.py
imports: import matplotlib.pyplot
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  import cartopy.crs
label_desc: Use image node_id 1 for calling a global function with example usage: test_extents() without return types