def plot_geography(
    proj4str,
    extent,
    lw=0.5,
    drawlonlatlines=False,
    drawlonlatlabels=True,
    plot_map="cartopy",
    scale="50m",
    subplot=None,
    **kwargs,
):
    """
    Plot geographical map in a chosen projection using cartopy.

    .. _SubplotSpec: https://matplotlib.org/api/_as_gen/matplotlib.gridspec.SubplotSpec.html

    Parameters
    ----------
    proj4str: str
        The PROJ.4-compatible projection string.
    extent: scalars (left, right, bottom, top)
        The bounding box in proj4str coordinates.
    lw: float, optional`
        Linewidth of the map (administrative boundaries and coastlines).
    drawlonlatlines: bool, optional
        If set to True, draw longitude and latitude lines.
    drawlonlatlabels: bool, optional
        If set to True, draw longitude and latitude labels.  Valid only if
        'drawlonlatlines' is True.
    plot_map: {'cartopy', None}, optional
        The type of basemap, either 'cartopy' or None. If None, the figure
        axis is returned without any basemap drawn. Default `'cartopy'`.
    scale: {'10m', '50m', '110m'}, optional
        The scale (resolution). Applicable if 'plot_map' is 'cartopy'.
        The available options are '10m', '50m', and '110m'. Default ``'50m'``.
    subplot: tuple of int (nrows, ncols, index) or SubplotSpec_ instance, optional
        The subplot where to plot the basemap.
        By the default, the basemap will replace the current axis.

    Returns
    -------
    ax: fig Axes
        Cartopy axes.
    """

    if len(kwargs) > 0:
        warnings.warn(
            "plot_geography: The following keywords are ignored:\n"
            + str(kwargs)
            + "\nIn version 1.5, passing unsupported arguments will raise an error.",
            DeprecationWarning,
        )

    if plot_map is None:
        return plt.gca()

    if plot_map not in VALID_BASEMAPS:
        raise ValueError(
            f"unsupported plot_map method {plot_map}. Supported basemaps: "
            f"{VALID_BASEMAPS}"
        )

    if plot_map == "cartopy" and not CARTOPY_IMPORTED:
        warnings.warn(
            "The cartopy package is required to plot the geographical map but it is "
            "not installed. Ignoring the geographic information."
        )
        return plt.gca()

    if not PYPROJ_IMPORTED:
        warnings.warn(
            "the pyproj package is required to plot the geographical map "
            "but it is not installed"
        )
        return plt.gca()

    crs = utils.proj4_to_cartopy(proj4str)

    ax = plot_map_cartopy(
        crs,
        extent,
        scale,
        drawlonlatlines=drawlonlatlines,
        drawlonlatlabels=drawlonlatlabels,
        lw=lw,
        subplot=subplot,
    )

    return ax
Plot geographical map in a chosen projection using cartopy.

.. _SubplotSpec: https://matplotlib.org/api/_as_gen/matplotlib.gridspec.SubplotSpec.html

Parameters
----------
proj4str: str
The PROJ.4-compatible projection string.
extent: scalars (left, right, bottom, top)
The bounding box in proj4str coordinates.
lw: float, optional`
Linewidth of the map (administrative boundaries and coastlines).
drawlonlatlines: bool, optional
If set to True, draw longitude and latitude lines.
drawlonlatlabels: bool, optional
If set to True, draw longitude and latitude labels.  Valid only if
'drawlonlatlines' is True.
plot_map: {'cartopy', None}, optional
The type of basemap, either 'cartopy' or None. If None, the figure
axis is returned without any basemap drawn. Default `'cartopy'`.
scale: {'10m', '50m', '110m'}, optional
The scale (resolution). Applicable if 'plot_map' is 'cartopy'.
The available options are '10m', '50m', and '110m'. Default ``'50m'``.
subplot: tuple of int (nrows, ncols, index) or SubplotSpec_ instance, optional
The subplot where to plot the basemap.
By the default, the basemap will replace the current axis.

Returns
-------
ax: fig Axes
Cartopy axes.
pysteps/visualization/basemaps.py