We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
GeographicPlotDisplay documentation missing description of return value
* ACT version:  2.1.1
* Python version: all
* Operating System: all

### Description

The GeographicPlotDisplay is missing a description of the returned matplotlib axes object. This proved to be a bit confusing on how to tell a student how to adjust the axes limits on the GeographicPlotDisplay, since doing so depends on calling the methods of the returned matplotlib axes object.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `act/plotting/geodisplay.py`
Content:
```
1 """
2 Stores the class for GeographicPlotDisplay.
3 
4 """
5 
6 
7 import matplotlib
8 import matplotlib.pyplot as plt
9 import numpy as np
10 import pandas as pd
11 
12 from .plot import Display
13 
14 try:
15     import cartopy.crs as ccrs
16     import cartopy.feature as cfeature
17     from cartopy.io import img_tiles
18 
19     CARTOPY_AVAILABLE = True
20 except ImportError:
21     CARTOPY_AVAILABLE = False
22 
23 
24 class GeographicPlotDisplay(Display):
25     """
26     A class for making geographic tracer plot of aircraft, ship or other moving
27     platform plot.
28 
29     This is inherited from the :func:`act.plotting.Display`
30     class and has therefore has the same attributes as that class.
31     See :func:`act.plotting.Display`
32     for more information. There are no additional attributes or parameters
33     to this class.
34 
35     In order to create geographic plots, ACT needs the Cartopy package to be
36     installed on your system. More information about
37     Cartopy go here:https://scitools.org.uk/cartopy/docs/latest/ .
38 
39     """
40 
41     def __init__(self, ds, ds_name=None, **kwargs):
42         if not CARTOPY_AVAILABLE:
43             raise ImportError(
44                 'Cartopy needs to be installed on your ' 'system to make geographic display plots.'
45             )
46         super().__init__(ds, ds_name, **kwargs)
47         if self.fig is None:
48             self.fig = plt.figure(**kwargs)
49 
50     def geoplot(
51         self,
52         data_field=None,
53         lat_field='lat',
54         lon_field='lon',
55         dsname=None,
56         cbar_label=None,
57         title=None,
58         projection=None,
59         plot_buffer=0.08,
60         img_tile=None,
61         img_tile_args={},
62         tile=8,
63         cartopy_feature=None,
64         cmap='rainbow',
65         text=None,
66         gridlines=True,
67         **kwargs,
68     ):
69         """
70         Creates a latitude and longitude plot of a time series data set with
71         data values indicated by color and described with a colorbar.
72         Latitude values must be in degree north (-90 to 90) and
73         longitude must be in degree east (-180 to 180).
74 
75         Parameters
76         ----------
77         data_field : str
78             Name of data field in the dataset to plot.
79         lat_field : str
80             Name of latitude field in the dataset to use.
81         lon_field : str
82             Name of longitude field in the dataset to use.
83         dsname : str or None
84             The name of the datastream to plot. Set to None to make ACT
85             attempt to automatically determine this.
86         cbar_label : str
87             Label to use with colorbar. If set to None will attempt
88             to create label from long_name and units.
89         title : str
90             Plot title.
91         projection : cartopy.crs object
92             Project to use on plot. See
93             https://scitools.org.uk/cartopy/docs/latest/reference/projections.html?highlight=projections
94         plot_buffer : float
95             Buffer to add around data on plot in lat and lon dimension.
96         img_tile : str
97             Image to use for the plot background. Set to None to not use
98             background image. For all image background types, see:
99             https://scitools.org.uk/cartopy/docs/v0.16/cartopy/io/img_tiles.html
100             Default is None.
101         img_tile_args : dict
102             Keyword arguments for the chosen img_tile. These arguments can be
103             found for the corresponding img_tile here:
104             https://scitools.org.uk/cartopy/docs/v0.16/cartopy/io/img_tiles.html
105             Default is an empty dictionary.
106         tile : int
107             Tile zoom to use with background image. Higher number indicates
108             more resolution. A value of 8 is typical for a normal sonde plot.
109         cartopy_feature : list of str or str
110             Cartopy feature to add to plot.
111         cmap : str
112             Color map to use for colorbar.
113         text : dictionary
114             Dictionary of {text:[lon,lat]} to add to plot. Can have more
115             than one set of text to add.
116         gridlines : boolean
117             Use latitude and longitude gridlines.
118         **kwargs : keyword arguments
119             Any other keyword arguments that will be passed
120             into :func:`matplotlib.pyplot.scatter` when the figure
121             is made. See the matplotlib documentation for further details
122             on what keyword arguments are available.
123 
124         """
125         if dsname is None and len(self._ds.keys()) > 1:
126             raise ValueError(
127                 'You must choose a datastream when there are 2 '
128                 'or more datasets in the GeographicPlotDisplay '
129                 'object.'
130             )
131         elif dsname is None:
132             dsname = list(self._ds.keys())[0]
133 
134         if data_field is None:
135             raise ValueError('You must enter the name of the data ' 'to be plotted.')
136 
137         if projection is None:
138             if CARTOPY_AVAILABLE:
139                 projection = ccrs.PlateCarree()
140 
141         # Extract data from the dataset
142         try:
143             lat = self._ds[dsname][lat_field].values
144         except KeyError:
145             raise ValueError(
146                 (
147                     'You will need to provide the name of the '
148                     "field if not '{}' to use for latitude "
149                     'data.'
150                 ).format(lat_field)
151             )
152         try:
153             lon = self._ds[dsname][lon_field].values
154         except KeyError:
155             raise ValueError(
156                 (
157                     'You will need to provide the name of the '
158                     "field if not '{}' to use for longitude "
159                     'data.'
160                 ).format(lon_field)
161             )
162 
163         # Set up metadata information for display on plot
164         if cbar_label is None:
165             try:
166                 cbar_label = (
167                     self._ds[dsname][data_field].attrs['long_name']
168                     + ' ('
169                     + self._ds[dsname][data_field].attrs['units']
170                     + ')'
171                 )
172             except KeyError:
173                 cbar_label = data_field
174 
175         lat_limits = [np.nanmin(lat), np.nanmax(lat)]
176         lon_limits = [np.nanmin(lon), np.nanmax(lon)]
177         box_size = np.max([np.abs(np.diff(lat_limits)), np.abs(np.diff(lon_limits))])
178         bx_buf = box_size * plot_buffer
179 
180         lat_center = np.sum(lat_limits) / 2.0
181         lon_center = np.sum(lon_limits) / 2.0
182 
183         lat_limits = [
184             lat_center - box_size / 2.0 - bx_buf,
185             lat_center + box_size / 2.0 + bx_buf,
186         ]
187         lon_limits = [
188             lon_center - box_size / 2.0 - bx_buf,
189             lon_center + box_size / 2.0 + bx_buf,
190         ]
191 
192         data = self._ds[dsname][data_field].values
193 
194         # Create base plot projection
195         ax = plt.axes(projection=projection)
196         plt.subplots_adjust(left=0.01, right=0.99, bottom=0.05, top=0.93)
197         ax.set_extent([lon_limits[0], lon_limits[1], lat_limits[0], lat_limits[1]], crs=projection)
198 
199         if title is None:
200             try:
201                 dim = list(self._ds[dsname][data_field].dims)
202                 ts = pd.to_datetime(str(self._ds[dsname][dim[0]].values[0]))
203                 date = ts.strftime('%Y-%m-%d')
204                 time_str = ts.strftime('%H:%M:%S')
205                 plt.title(' '.join([dsname, 'at', date, time_str]))
206             except NameError:
207                 plt.title(dsname)
208         else:
209             plt.title(title)
210 
211         if img_tile is not None:
212             tiler = getattr(img_tiles, img_tile)(**img_tile_args)
213             ax.add_image(tiler, tile)
214 
215         colorbar_map = None
216         if cmap is not None:
217             colorbar_map = matplotlib.colormaps.get_cmap(cmap)
218         sc = ax.scatter(lon, lat, c=data, cmap=colorbar_map, **kwargs)
219         cbar = plt.colorbar(sc)
220         cbar.ax.set_ylabel(cbar_label)
221         if cartopy_feature is not None:
222             if isinstance(cartopy_feature, str):
223                 cartopy_feature = [cartopy_feature]
224             cartopy_feature = [ii.upper() for ii in cartopy_feature]
225             if 'STATES' in cartopy_feature:
226                 ax.add_feature(cfeature.STATES.with_scale('10m'))
227             if 'LAND' in cartopy_feature:
228                 ax.add_feature(cfeature.LAND)
229             if 'OCEAN' in cartopy_feature:
230                 ax.add_feature(cfeature.OCEAN)
231             if 'COASTLINE' in cartopy_feature:
232                 ax.add_feature(cfeature.COASTLINE)
233             if 'BORDERS' in cartopy_feature:
234                 ax.add_feature(cfeature.BORDERS, linestyle=':')
235             if 'LAKES' in cartopy_feature:
236                 ax.add_feature(cfeature.LAKES, alpha=0.5)
237             if 'RIVERS' in cartopy_feature:
238                 ax.add_feature(cfeature.RIVERS)
239         if text is not None:
240             for label, location in text.items():
241                 ax.plot(location[0], location[1], marker='*', color='black')
242                 ax.text(location[0], location[1], label, color='black')
243 
244         if gridlines:
245             if projection == ccrs.PlateCarree() or projection == ccrs.Mercator:
246                 gl = ax.gridlines(
247                     crs=projection,
248                     draw_labels=True,
249                     linewidth=1,
250                     color='gray',
251                     alpha=0.5,
252                     linestyle='--',
253                 )
254                 gl.top_labels = False
255                 gl.left_labels = True
256                 gl.bottom_labels = True
257                 gl.right_labels = False
258                 gl.xlabel_style = {'size': 6, 'color': 'gray'}
259                 gl.ylabel_style = {'size': 6, 'color': 'gray'}
260             else:
261                 # Labels are only currently supported for PlateCarree and Mercator
262                 gl = ax.gridlines(
263                     draw_labels=False,
264                     linewidth=1,
265                     color='gray',
266                     alpha=0.5,
267                     linestyle='--',
268                 )
269 
270         return ax
271
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/act/plotting/geodisplay.py b/act/plotting/geodisplay.py
--- a/act/plotting/geodisplay.py
+++ b/act/plotting/geodisplay.py
@@ -121,6 +121,11 @@
             is made. See the matplotlib documentation for further details
             on what keyword arguments are available.
 
+        Returns
+        -------
+        ax : matplotlib axis handle
+            The matplotlib axis handle of the plot.
+
         """
         if dsname is None and len(self._ds.keys()) > 1:
             raise ValueError(

{"golden_diff": "diff --git a/act/plotting/geodisplay.py b/act/plotting/geodisplay.py\n--- a/act/plotting/geodisplay.py\n+++ b/act/plotting/geodisplay.py\n@@ -121,6 +121,11 @@\n             is made. See the matplotlib documentation for further details\n             on what keyword arguments are available.\n \n+        Returns\n+        -------\n+        ax : matplotlib axis handle\n+            The matplotlib axis handle of the plot.\n+\n         \"\"\"\n         if dsname is None and len(self._ds.keys()) > 1:\n             raise ValueError(\n", "issue": "GeographicPlotDisplay documentation missing description of return value\n* ACT version:  2.1.1\r\n* Python version: all\r\n* Operating System: all\r\n\r\n### Description\r\n\r\nThe GeographicPlotDisplay is missing a description of the returned matplotlib axes object. This proved to be a bit confusing on how to tell a student how to adjust the axes limits on the GeographicPlotDisplay, since doing so depends on calling the methods of the returned matplotlib axes object.\r\n\n", "before_files": [{"content": "\"\"\"\nStores the class for GeographicPlotDisplay.\n\n\"\"\"\n\n\nimport matplotlib\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\n\nfrom .plot import Display\n\ntry:\n    import cartopy.crs as ccrs\n    import cartopy.feature as cfeature\n    from cartopy.io import img_tiles\n\n    CARTOPY_AVAILABLE = True\nexcept ImportError:\n    CARTOPY_AVAILABLE = False\n\n\nclass GeographicPlotDisplay(Display):\n    \"\"\"\n    A class for making geographic tracer plot of aircraft, ship or other moving\n    platform plot.\n\n    This is inherited from the :func:`act.plotting.Display`\n    class and has therefore has the same attributes as that class.\n    See :func:`act.plotting.Display`\n    for more information. There are no additional attributes or parameters\n    to this class.\n\n    In order to create geographic plots, ACT needs the Cartopy package to be\n    installed on your system. More information about\n    Cartopy go here:https://scitools.org.uk/cartopy/docs/latest/ .\n\n    \"\"\"\n\n    def __init__(self, ds, ds_name=None, **kwargs):\n        if not CARTOPY_AVAILABLE:\n            raise ImportError(\n                'Cartopy needs to be installed on your ' 'system to make geographic display plots.'\n            )\n        super().__init__(ds, ds_name, **kwargs)\n        if self.fig is None:\n            self.fig = plt.figure(**kwargs)\n\n    def geoplot(\n        self,\n        data_field=None,\n        lat_field='lat',\n        lon_field='lon',\n        dsname=None,\n        cbar_label=None,\n        title=None,\n        projection=None,\n        plot_buffer=0.08,\n        img_tile=None,\n        img_tile_args={},\n        tile=8,\n        cartopy_feature=None,\n        cmap='rainbow',\n        text=None,\n        gridlines=True,\n        **kwargs,\n    ):\n        \"\"\"\n        Creates a latitude and longitude plot of a time series data set with\n        data values indicated by color and described with a colorbar.\n        Latitude values must be in degree north (-90 to 90) and\n        longitude must be in degree east (-180 to 180).\n\n        Parameters\n        ----------\n        data_field : str\n            Name of data field in the dataset to plot.\n        lat_field : str\n            Name of latitude field in the dataset to use.\n        lon_field : str\n            Name of longitude field in the dataset to use.\n        dsname : str or None\n            The name of the datastream to plot. Set to None to make ACT\n            attempt to automatically determine this.\n        cbar_label : str\n            Label to use with colorbar. If set to None will attempt\n            to create label from long_name and units.\n        title : str\n            Plot title.\n        projection : cartopy.crs object\n            Project to use on plot. See\n            https://scitools.org.uk/cartopy/docs/latest/reference/projections.html?highlight=projections\n        plot_buffer : float\n            Buffer to add around data on plot in lat and lon dimension.\n        img_tile : str\n            Image to use for the plot background. Set to None to not use\n            background image. For all image background types, see:\n            https://scitools.org.uk/cartopy/docs/v0.16/cartopy/io/img_tiles.html\n            Default is None.\n        img_tile_args : dict\n            Keyword arguments for the chosen img_tile. These arguments can be\n            found for the corresponding img_tile here:\n            https://scitools.org.uk/cartopy/docs/v0.16/cartopy/io/img_tiles.html\n            Default is an empty dictionary.\n        tile : int\n            Tile zoom to use with background image. Higher number indicates\n            more resolution. A value of 8 is typical for a normal sonde plot.\n        cartopy_feature : list of str or str\n            Cartopy feature to add to plot.\n        cmap : str\n            Color map to use for colorbar.\n        text : dictionary\n            Dictionary of {text:[lon,lat]} to add to plot. Can have more\n            than one set of text to add.\n        gridlines : boolean\n            Use latitude and longitude gridlines.\n        **kwargs : keyword arguments\n            Any other keyword arguments that will be passed\n            into :func:`matplotlib.pyplot.scatter` when the figure\n            is made. See the matplotlib documentation for further details\n            on what keyword arguments are available.\n\n        \"\"\"\n        if dsname is None and len(self._ds.keys()) > 1:\n            raise ValueError(\n                'You must choose a datastream when there are 2 '\n                'or more datasets in the GeographicPlotDisplay '\n                'object.'\n            )\n        elif dsname is None:\n            dsname = list(self._ds.keys())[0]\n\n        if data_field is None:\n            raise ValueError('You must enter the name of the data ' 'to be plotted.')\n\n        if projection is None:\n            if CARTOPY_AVAILABLE:\n                projection = ccrs.PlateCarree()\n\n        # Extract data from the dataset\n        try:\n            lat = self._ds[dsname][lat_field].values\n        except KeyError:\n            raise ValueError(\n                (\n                    'You will need to provide the name of the '\n                    \"field if not '{}' to use for latitude \"\n                    'data.'\n                ).format(lat_field)\n            )\n        try:\n            lon = self._ds[dsname][lon_field].values\n        except KeyError:\n            raise ValueError(\n                (\n                    'You will need to provide the name of the '\n                    \"field if not '{}' to use for longitude \"\n                    'data.'\n                ).format(lon_field)\n            )\n\n        # Set up metadata information for display on plot\n        if cbar_label is None:\n            try:\n                cbar_label = (\n                    self._ds[dsname][data_field].attrs['long_name']\n                    + ' ('\n                    + self._ds[dsname][data_field].attrs['units']\n                    + ')'\n                )\n            except KeyError:\n                cbar_label = data_field\n\n        lat_limits = [np.nanmin(lat), np.nanmax(lat)]\n        lon_limits = [np.nanmin(lon), np.nanmax(lon)]\n        box_size = np.max([np.abs(np.diff(lat_limits)), np.abs(np.diff(lon_limits))])\n        bx_buf = box_size * plot_buffer\n\n        lat_center = np.sum(lat_limits) / 2.0\n        lon_center = np.sum(lon_limits) / 2.0\n\n        lat_limits = [\n            lat_center - box_size / 2.0 - bx_buf,\n            lat_center + box_size / 2.0 + bx_buf,\n        ]\n        lon_limits = [\n            lon_center - box_size / 2.0 - bx_buf,\n            lon_center + box_size / 2.0 + bx_buf,\n        ]\n\n        data = self._ds[dsname][data_field].values\n\n        # Create base plot projection\n        ax = plt.axes(projection=projection)\n        plt.subplots_adjust(left=0.01, right=0.99, bottom=0.05, top=0.93)\n        ax.set_extent([lon_limits[0], lon_limits[1], lat_limits[0], lat_limits[1]], crs=projection)\n\n        if title is None:\n            try:\n                dim = list(self._ds[dsname][data_field].dims)\n                ts = pd.to_datetime(str(self._ds[dsname][dim[0]].values[0]))\n                date = ts.strftime('%Y-%m-%d')\n                time_str = ts.strftime('%H:%M:%S')\n                plt.title(' '.join([dsname, 'at', date, time_str]))\n            except NameError:\n                plt.title(dsname)\n        else:\n            plt.title(title)\n\n        if img_tile is not None:\n            tiler = getattr(img_tiles, img_tile)(**img_tile_args)\n            ax.add_image(tiler, tile)\n\n        colorbar_map = None\n        if cmap is not None:\n            colorbar_map = matplotlib.colormaps.get_cmap(cmap)\n        sc = ax.scatter(lon, lat, c=data, cmap=colorbar_map, **kwargs)\n        cbar = plt.colorbar(sc)\n        cbar.ax.set_ylabel(cbar_label)\n        if cartopy_feature is not None:\n            if isinstance(cartopy_feature, str):\n                cartopy_feature = [cartopy_feature]\n            cartopy_feature = [ii.upper() for ii in cartopy_feature]\n            if 'STATES' in cartopy_feature:\n                ax.add_feature(cfeature.STATES.with_scale('10m'))\n            if 'LAND' in cartopy_feature:\n                ax.add_feature(cfeature.LAND)\n            if 'OCEAN' in cartopy_feature:\n                ax.add_feature(cfeature.OCEAN)\n            if 'COASTLINE' in cartopy_feature:\n                ax.add_feature(cfeature.COASTLINE)\n            if 'BORDERS' in cartopy_feature:\n                ax.add_feature(cfeature.BORDERS, linestyle=':')\n            if 'LAKES' in cartopy_feature:\n                ax.add_feature(cfeature.LAKES, alpha=0.5)\n            if 'RIVERS' in cartopy_feature:\n                ax.add_feature(cfeature.RIVERS)\n        if text is not None:\n            for label, location in text.items():\n                ax.plot(location[0], location[1], marker='*', color='black')\n                ax.text(location[0], location[1], label, color='black')\n\n        if gridlines:\n            if projection == ccrs.PlateCarree() or projection == ccrs.Mercator:\n                gl = ax.gridlines(\n                    crs=projection,\n                    draw_labels=True,\n                    linewidth=1,\n                    color='gray',\n                    alpha=0.5,\n                    linestyle='--',\n                )\n                gl.top_labels = False\n                gl.left_labels = True\n                gl.bottom_labels = True\n                gl.right_labels = False\n                gl.xlabel_style = {'size': 6, 'color': 'gray'}\n                gl.ylabel_style = {'size': 6, 'color': 'gray'}\n            else:\n                # Labels are only currently supported for PlateCarree and Mercator\n                gl = ax.gridlines(\n                    draw_labels=False,\n                    linewidth=1,\n                    color='gray',\n                    alpha=0.5,\n                    linestyle='--',\n                )\n\n        return ax\n", "path": "act/plotting/geodisplay.py"}], "after_files": [{"content": "\"\"\"\nStores the class for GeographicPlotDisplay.\n\n\"\"\"\n\n\nimport matplotlib\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\n\nfrom .plot import Display\n\ntry:\n    import cartopy.crs as ccrs\n    import cartopy.feature as cfeature\n    from cartopy.io import img_tiles\n\n    CARTOPY_AVAILABLE = True\nexcept ImportError:\n    CARTOPY_AVAILABLE = False\n\n\nclass GeographicPlotDisplay(Display):\n    \"\"\"\n    A class for making geographic tracer plot of aircraft, ship or other moving\n    platform plot.\n\n    This is inherited from the :func:`act.plotting.Display`\n    class and has therefore has the same attributes as that class.\n    See :func:`act.plotting.Display`\n    for more information. There are no additional attributes or parameters\n    to this class.\n\n    In order to create geographic plots, ACT needs the Cartopy package to be\n    installed on your system. More information about\n    Cartopy go here:https://scitools.org.uk/cartopy/docs/latest/ .\n\n    \"\"\"\n\n    def __init__(self, ds, ds_name=None, **kwargs):\n        if not CARTOPY_AVAILABLE:\n            raise ImportError(\n                'Cartopy needs to be installed on your ' 'system to make geographic display plots.'\n            )\n        super().__init__(ds, ds_name, **kwargs)\n        if self.fig is None:\n            self.fig = plt.figure(**kwargs)\n\n    def geoplot(\n        self,\n        data_field=None,\n        lat_field='lat',\n        lon_field='lon',\n        dsname=None,\n        cbar_label=None,\n        title=None,\n        projection=None,\n        plot_buffer=0.08,\n        img_tile=None,\n        img_tile_args={},\n        tile=8,\n        cartopy_feature=None,\n        cmap='rainbow',\n        text=None,\n        gridlines=True,\n        **kwargs,\n    ):\n        \"\"\"\n        Creates a latitude and longitude plot of a time series data set with\n        data values indicated by color and described with a colorbar.\n        Latitude values must be in degree north (-90 to 90) and\n        longitude must be in degree east (-180 to 180).\n\n        Parameters\n        ----------\n        data_field : str\n            Name of data field in the dataset to plot.\n        lat_field : str\n            Name of latitude field in the dataset to use.\n        lon_field : str\n            Name of longitude field in the dataset to use.\n        dsname : str or None\n            The name of the datastream to plot. Set to None to make ACT\n            attempt to automatically determine this.\n        cbar_label : str\n            Label to use with colorbar. If set to None will attempt\n            to create label from long_name and units.\n        title : str\n            Plot title.\n        projection : cartopy.crs object\n            Project to use on plot. See\n            https://scitools.org.uk/cartopy/docs/latest/reference/projections.html?highlight=projections\n        plot_buffer : float\n            Buffer to add around data on plot in lat and lon dimension.\n        img_tile : str\n            Image to use for the plot background. Set to None to not use\n            background image. For all image background types, see:\n            https://scitools.org.uk/cartopy/docs/v0.16/cartopy/io/img_tiles.html\n            Default is None.\n        img_tile_args : dict\n            Keyword arguments for the chosen img_tile. These arguments can be\n            found for the corresponding img_tile here:\n            https://scitools.org.uk/cartopy/docs/v0.16/cartopy/io/img_tiles.html\n            Default is an empty dictionary.\n        tile : int\n            Tile zoom to use with background image. Higher number indicates\n            more resolution. A value of 8 is typical for a normal sonde plot.\n        cartopy_feature : list of str or str\n            Cartopy feature to add to plot.\n        cmap : str\n            Color map to use for colorbar.\n        text : dictionary\n            Dictionary of {text:[lon,lat]} to add to plot. Can have more\n            than one set of text to add.\n        gridlines : boolean\n            Use latitude and longitude gridlines.\n        **kwargs : keyword arguments\n            Any other keyword arguments that will be passed\n            into :func:`matplotlib.pyplot.scatter` when the figure\n            is made. See the matplotlib documentation for further details\n            on what keyword arguments are available.\n\n        Returns\n        -------\n        ax : matplotlib axis handle\n            The matplotlib axis handle of the plot.\n\n        \"\"\"\n        if dsname is None and len(self._ds.keys()) > 1:\n            raise ValueError(\n                'You must choose a datastream when there are 2 '\n                'or more datasets in the GeographicPlotDisplay '\n                'object.'\n            )\n        elif dsname is None:\n            dsname = list(self._ds.keys())[0]\n\n        if data_field is None:\n            raise ValueError('You must enter the name of the data ' 'to be plotted.')\n\n        if projection is None:\n            if CARTOPY_AVAILABLE:\n                projection = ccrs.PlateCarree()\n\n        # Extract data from the dataset\n        try:\n            lat = self._ds[dsname][lat_field].values\n        except KeyError:\n            raise ValueError(\n                (\n                    'You will need to provide the name of the '\n                    \"field if not '{}' to use for latitude \"\n                    'data.'\n                ).format(lat_field)\n            )\n        try:\n            lon = self._ds[dsname][lon_field].values\n        except KeyError:\n            raise ValueError(\n                (\n                    'You will need to provide the name of the '\n                    \"field if not '{}' to use for longitude \"\n                    'data.'\n                ).format(lon_field)\n            )\n\n        # Set up metadata information for display on plot\n        if cbar_label is None:\n            try:\n                cbar_label = (\n                    self._ds[dsname][data_field].attrs['long_name']\n                    + ' ('\n                    + self._ds[dsname][data_field].attrs['units']\n                    + ')'\n                )\n            except KeyError:\n                cbar_label = data_field\n\n        lat_limits = [np.nanmin(lat), np.nanmax(lat)]\n        lon_limits = [np.nanmin(lon), np.nanmax(lon)]\n        box_size = np.max([np.abs(np.diff(lat_limits)), np.abs(np.diff(lon_limits))])\n        bx_buf = box_size * plot_buffer\n\n        lat_center = np.sum(lat_limits) / 2.0\n        lon_center = np.sum(lon_limits) / 2.0\n\n        lat_limits = [\n            lat_center - box_size / 2.0 - bx_buf,\n            lat_center + box_size / 2.0 + bx_buf,\n        ]\n        lon_limits = [\n            lon_center - box_size / 2.0 - bx_buf,\n            lon_center + box_size / 2.0 + bx_buf,\n        ]\n\n        data = self._ds[dsname][data_field].values\n\n        # Create base plot projection\n        ax = plt.axes(projection=projection)\n        plt.subplots_adjust(left=0.01, right=0.99, bottom=0.05, top=0.93)\n        ax.set_extent([lon_limits[0], lon_limits[1], lat_limits[0], lat_limits[1]], crs=projection)\n\n        if title is None:\n            try:\n                dim = list(self._ds[dsname][data_field].dims)\n                ts = pd.to_datetime(str(self._ds[dsname][dim[0]].values[0]))\n                date = ts.strftime('%Y-%m-%d')\n                time_str = ts.strftime('%H:%M:%S')\n                plt.title(' '.join([dsname, 'at', date, time_str]))\n            except NameError:\n                plt.title(dsname)\n        else:\n            plt.title(title)\n\n        if img_tile is not None:\n            tiler = getattr(img_tiles, img_tile)(**img_tile_args)\n            ax.add_image(tiler, tile)\n\n        colorbar_map = None\n        if cmap is not None:\n            colorbar_map = matplotlib.colormaps.get_cmap(cmap)\n        sc = ax.scatter(lon, lat, c=data, cmap=colorbar_map, **kwargs)\n        cbar = plt.colorbar(sc)\n        cbar.ax.set_ylabel(cbar_label)\n        if cartopy_feature is not None:\n            if isinstance(cartopy_feature, str):\n                cartopy_feature = [cartopy_feature]\n            cartopy_feature = [ii.upper() for ii in cartopy_feature]\n            if 'STATES' in cartopy_feature:\n                ax.add_feature(cfeature.STATES.with_scale('10m'))\n            if 'LAND' in cartopy_feature:\n                ax.add_feature(cfeature.LAND)\n            if 'OCEAN' in cartopy_feature:\n                ax.add_feature(cfeature.OCEAN)\n            if 'COASTLINE' in cartopy_feature:\n                ax.add_feature(cfeature.COASTLINE)\n            if 'BORDERS' in cartopy_feature:\n                ax.add_feature(cfeature.BORDERS, linestyle=':')\n            if 'LAKES' in cartopy_feature:\n                ax.add_feature(cfeature.LAKES, alpha=0.5)\n            if 'RIVERS' in cartopy_feature:\n                ax.add_feature(cfeature.RIVERS)\n        if text is not None:\n            for label, location in text.items():\n                ax.plot(location[0], location[1], marker='*', color='black')\n                ax.text(location[0], location[1], label, color='black')\n\n        if gridlines:\n            if projection == ccrs.PlateCarree() or projection == ccrs.Mercator:\n                gl = ax.gridlines(\n                    crs=projection,\n                    draw_labels=True,\n                    linewidth=1,\n                    color='gray',\n                    alpha=0.5,\n                    linestyle='--',\n                )\n                gl.top_labels = False\n                gl.left_labels = True\n                gl.bottom_labels = True\n                gl.right_labels = False\n                gl.xlabel_style = {'size': 6, 'color': 'gray'}\n                gl.ylabel_style = {'size': 6, 'color': 'gray'}\n            else:\n                # Labels are only currently supported for PlateCarree and Mercator\n                gl = ax.gridlines(\n                    draw_labels=False,\n                    linewidth=1,\n                    color='gray',\n                    alpha=0.5,\n                    linestyle='--',\n                )\n\n        return ax\n", "path": "act/plotting/geodisplay.py"}]}