Repository: SciTools/cartopy

Issue:
Hiding part of gridline labels
### Description
I am running the latest master branch  https://github.com/SciTools/cartopy/commit/0e5eef86afe3502bfc41b84f71ba2bf48e2812bd as I want to add labels for a proj4 grid. 
This is working very well, thank you for the work you've put in.

When I want to remove some of the labels, following the example in https://scitools.org.uk/cartopy/docs/v0.17/matplotlib/gridliner.html none of the labels are removed.


#### Code to reproduce
From the example running on python 3.6.8
```
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import cartopy.crs as ccrs

from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER


ax = plt.axes(projection=ccrs.Mercator())
ax.coastlines()

gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=2, color='gray', alpha=0.5, linestyle='--')
gl.xlabels_top = False
gl.ylabels_left = False
gl.xlines = False
gl.xlocator = mticker.FixedLocator([-180, -45, 0, 45, 180])
gl.xformatter = LONGITUDE_FORMATTER
gl.yformatter = LATITUDE_FORMATTER
gl.xlabel_style = {'size': 15, 'color': 'gray'}
gl.xlabel_style = {'color': 'red', 'weight': 'bold'}

plt.show()
```

![Figure_1](https://user-images.githubusercontent.com/1961991/66654003-8cbd0680-ec39-11e9-833a-a078f5d8d0fb.png)

<details>
 <summary>Full environment definition</summary>


### Operating system
Linux Mint 19.2

### Cartopy version
https://github.com/SciTools/cartopy/commit/0e5eef86afe3502bfc41b84f71ba2bf48e2812bd


### pip3 list

```
aggdraw (1.3.11)
apt-clone (0.2.1)
apturl (0.5.2)
arrow (0.15.2)
asciitree (0.3.3)
attrs (19.1.0)
autopep8 (1.4.4)
backcall (0.1.0)
beautifulsoup4 (4.6.0)
bleach (3.1.0)
blessings (1.6)
bpython (0.17.1)
Brlapi (0.6.6)
Cartopy (0.17.1.dev174-)
catfish (1.4.4)
certifi (2019.6.16)
cftime (1.0.3.4)
chardet (3.0.4)
Click (7.0)
cloudpickle (1.2.2)
command-not-found (0.3)
configobj (5.0.6)
cupshelpers (1.0)
curtsies (0.2.12)
cycler (0.10.0)
Cython (0.29.13)
dask (2.5.2)
decorator (4.4.0)
defer (1.0.6)
defusedxml (0.6.0)
dokuwikixmlrpc (2010-07-19)
entrypoints (0.3)
fasteners (0.15)
fsspec (0.5.2)
GDAL (2.2.2)
geojson (2.5.0)
geomet (0.2.1)
greenlet (0.4.12)
h5netcdf (0.7.4)
h5py (2.10.0)
hdf5storage (0.1.14)
html2text (2019.8.11)
html5lib (0.999999999)
httplib2 (0.9.2)
idna (2.8)
imageio (2.5.0)
ipykernel (5.1.2)
ipympl (0.3.3)
ipython (7.7.0)
ipython-genutils (0.2.0)
ipywidgets (7.5.1)
jedi (0.15.1)
Jinja2 (2.10.1)
json5 (0.8.5)
jsonschema (3.0.2)
jupyter-client (5.3.1)
jupyter-core (4.5.0)
jupyterlab (1.0.4)
jupyterlab-server (1.0.0)
kiwisolver (1.1.0)
locket (0.2.0)
louis (3.5.0)
Mako (1.0.7)
MarkupSafe (1.1.1)
matplotlib (3.1.1)
menulibre (2.2.0)
mistune (0.8.4)
monotonic (1.5)
mugshot (0.4.0)
nbconvert (5.6.0)
nbformat (4.4.0)
netCDF4 (1.5.2)
netifaces (0.10.4)
networkx (2.3)
notebook (6.0.0)
notedown (1.5.1)
numcodecs (0.6.3)
numpy (1.17.2)
onboard (1.4.1)
pandas (0.25.1)
pandoc-attributes (0.1.7)
pandocfilters (1.4.2)
parso (0.5.1)
partd (1.0.0)
pexpect (4.7.0)
pickleshare (0.7.5)
Pillow (6.2.0)
pip (9.0.1)
primefac (1.1)
proj (0.1.0)
prometheus-client (0.7.1)
prompt-toolkit (2.0.9)
psutil (5.4.2)
ptyprocess (0.6.0)
pycairo (1.16.2)
pycoast (1.2.3)
pycodestyle (2.5.0)
pycrypto (2.6.1)
pycups (1.9.73)
pycurl (7.43.0.1)
Pygments (2.4.2)
pygobject (3.26.1)
PyICU (1.9.8)
pykdtree (1.3.1)
pyorbital (1.5.0)
pyparsing (2.4.2)
pyproj (2.4.0)
pyresample (1.13.1)
pyrsistent (0.15.4)
pyshp (2.1.0)
pysmbc (1.0.15.6)
python-apt (1.6.4)
python-dateutil (2.8.0)
python-debian (0.1.32)
python-geotiepoints (1.1.8)
python-xapp (1.6.0)
python-xlib (0.20)
pytz (2019.3)
PyWavelets (1.0.3)
pyxdg (0.25)
PyYAML (3.12)
pyzmq (18.1.0)
reportlab (3.4.0)
requests (2.22.0)
requests-unixsocket (0.1.5)
satpy (0.17.0, /home/pal/gitRepo/satpy)
scikit-image (0.15.0)
scipy (1.3.1)
screen-resolution-extra (0.0.0)
Send2Trash (1.5.0)
sentinelsat (0.13)
sessioninstaller (0.0.0)
setproctitle (1.1.10)
setuptools (41.0.1)
Shapely (1.6.4.post2)
simplegeneric (0.8.1)
six (1.12.0)
system-service (0.3)
systemd-python (234)
terminado (0.8.2)
testpath (0.4.2)
toolz (0.10.0)
tornado (6.0.3)
tqdm (4.35.0)
traitlets (4.3.2)
trollimage (1.10.1)
trollsift (0.3.2)
ubuntu-drivers-common (0.0.0)
ufw (0.36)
urllib3 (1.25.3)
wcwidth (0.1.7)
webencodings (0.5.1)
wheel (0.33.6)
widgetsnbextension (3.5.1)
xarray (0.12.3)
xkit (0.0.0)
zarr (2.3.2)

```

</details>



Discussion:
I can reproduce this locally on current master. It worked fine for me on 0.17.0, so definitely a regression.

Resolving patch:
diff --git a/lib/cartopy/mpl/gridliner.py b/lib/cartopy/mpl/gridliner.py
--- a/lib/cartopy/mpl/gridliner.py
+++ b/lib/cartopy/mpl/gridliner.py
@@ -1,4 +1,4 @@
-# (C) British Crown Copyright 2011 - 2019, Met Office
+# (C) British Crown Copyright 2011 - 2020, Met Office
 #
 # This file is part of cartopy.
 #
@@ -294,6 +294,54 @@ def __init__(self, axes, crs, draw_labels=False, xlocator=None,
         # (or once drawn, only at resize event ?)
         self.axes.figure.canvas.mpl_connect('draw_event', self._draw_event)
 
+    @property
+    def xlabels_top(self):
+        warnings.warn('The .xlabels_top attribute is deprecated. Please '
+                      'use .top_labels to toggle visibility instead.')
+        return self.top_labels
+
+    @xlabels_top.setter
+    def xlabels_top(self, value):
+        warnings.warn('The .xlabels_top attribute is deprecated. Please '
+                      'use .top_labels to toggle visibility instead.')
+        self.top_labels = value
+
+    @property
+    def xlabels_bottom(self):
+        warnings.warn('The .xlabels_bottom attribute is deprecated. Please '
+                      'use .bottom_labels to toggle visibility instead.')
+        return self.bottom_labels
+
+    @xlabels_bottom.setter
+    def xlabels_bottom(self, value):
+        warnings.warn('The .xlabels_bottom attribute is deprecated. Please '
+                      'use .bottom_labels to toggle visibility instead.')
+        self.bottom_labels = value
+
+    @property
+    def ylabels_left(self):
+        warnings.warn('The .ylabels_left attribute is deprecated. Please '
+                      'use .left_labels to toggle visibility instead.')
+        return self.left_labels
+
+    @ylabels_left.setter
+    def ylabels_left(self, value):
+        warnings.warn('The .ylabels_left attribute is deprecated. Please '
+                      'use .left_labels to toggle visibility instead.')
+        self.left_labels = value
+
+    @property
+    def ylabels_right(self):
+        warnings.warn('The .ylabels_right attribute is deprecated. Please '
+                      'use .right_labels to toggle visibility instead.')
+        return self.right_labels
+
+    @ylabels_right.setter
+    def ylabels_right(self, value):
+        warnings.warn('The .ylabels_right attribute is deprecated. Please '
+                      'use .right_labels to toggle visibility instead.')
+        self.right_labels = value
+
     def _draw_event(self, event):
         if self.has_labels():
             self._update_labels_visibility(event.renderer)


Test patch: