Skip to content

Cartopy does not correctly hide labels set as 'False' #1722

@tvaillantdeguelis

Description

@tvaillantdeguelis

Description

Hi everyone!

I'm very new with Cartopy (I've been using Basemap for a while) and I'm trying to make quite basic stuffs, like choosing a projection and adding lat/lon labels. Things work fine with PlateCarree, but things get weird when I use another projection. I only try to hide top and right labels and here is what I get. I guess this is a bug(?).

Code to reproduce

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(10, 6))

ax = plt.subplot(2,2,1,projection=ccrs.PlateCarree())
gl = ax.gridlines(draw_labels=True)
gl.top_labels = False
gl.right_labels = False

ax = plt.subplot(2,2,2,projection=ccrs.EqualEarth())
gl = ax.gridlines(draw_labels=True)
gl.top_labels = False
gl.right_labels = False

ax = plt.subplot(2,2,3,projection=ccrs.Robinson())
gl = ax.gridlines(draw_labels=True)
gl.top_labels = False
gl.right_labels = False

ax = plt.subplot(2,2,4,projection=ccrs.Mollweide())
gl = ax.gridlines(draw_labels=True)
gl.top_labels = False
gl.right_labels = False

plt.savefig('maps.png')

maps

Full environment definition

Operating system

GNU/Linux
20.04.1-Ubuntu
5.8.0-41-generic
x86_64

Cartopy version

Cartopy 0.18.0

conda list

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
argon2-cffi               20.1.0           py38h7b6447c_1    anaconda
async_generator           1.10                       py_0    anaconda
attrs                     20.2.0                     py_0    anaconda
backcall                  0.2.0                      py_0    anaconda
blas                      1.0                         mkl  
bleach                    3.2.1                      py_0    anaconda
brotlipy                  0.7.0           py38h27cfd23_1003  
bzip2                     1.0.8                h7b6447c_0  
ca-certificates           2021.1.19            h06a4308_0  
cartopy                   0.18.0           py38hee755e7_0  
certifi                   2020.12.5        py38h06a4308_0  
cffi                      1.14.3           py38h261ae71_2  
cftime                    1.3.1            py38h6323ea4_0  
chardet                   3.0.4           py38h06a4308_1003  
conda                     4.9.2            py38h06a4308_0  
conda-package-handling    1.7.2            py38h03888b9_0  
cryptography              3.2.1            py38h3c74f83_1  
curl                      7.71.1               hbc83047_1  
cycler                    0.10.0                   py38_0  
dbus                      1.13.18              hb2f20db_0    anaconda
decorator                 4.4.2                      py_0    anaconda
defusedxml                0.6.0                      py_0    anaconda
entrypoints               0.3                      py38_0    anaconda
expat                     2.2.10               he6710b0_2    anaconda
fontconfig                2.13.0               h9420a91_0    anaconda
freetype                  2.10.4               h5ab3b9f_0    anaconda
geos                      3.8.0                he6710b0_0  
glib                      2.56.2               hd408876_0    anaconda
gst-plugins-base          1.14.0               hbbd80ab_1    anaconda
gstreamer                 1.14.0               hb453b48_1    anaconda
hdf4                      4.2.13               h3ca952b_2  
hdf5                      1.10.4               hb1b8bf9_0  
icu                       58.2                 he6710b0_3    anaconda
idna                      2.10                       py_0  
importlib-metadata        2.0.0                      py_1    anaconda
importlib_metadata        2.0.0                         1    anaconda
intel-openmp              2020.2                      254  
ipykernel                 5.3.4            py38h5ca1d4c_0    anaconda
ipython                   7.19.0           py38hb070fc8_1  
ipython_genutils          0.2.0                    py38_0    anaconda
ipywidgets                7.5.1                      py_1    anaconda
jedi                      0.17.2                   py38_0    anaconda
jinja2                    2.11.2                     py_0    anaconda
jpeg                      9b                   habf39ab_1    anaconda
jsonschema                3.2.0                      py_2    anaconda
jupyter                   1.0.0                    py38_7    anaconda
jupyter_client            6.1.7                      py_0    anaconda
jupyter_console           6.2.0                      py_0    anaconda
jupyter_core              4.6.3                    py38_0    anaconda
jupyterlab_pygments       0.1.2                      py_0    anaconda
kiwisolver                1.3.0            py38h2531618_0  
krb5                      1.18.2               h173b8e3_0  
lcms2                     2.11                 h396b838_0  
ld_impl_linux-64          2.33.1               h53a641e_7  
libcurl                   7.71.1               h20c2e04_1  
libedit                   3.1.20191231         h14c3975_1  
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.3.0                hdf63c60_0  
libnetcdf                 4.7.3                hb80b6cc_0  
libpng                    1.6.37               hbc83047_0    anaconda
libsodium                 1.0.18               h7b6447c_0    anaconda
libssh2                   1.9.0                h1ba5d50_1  
libstdcxx-ng              9.1.0                hdf63c60_0  
libtiff                   4.1.0                h2733197_1  
libuuid                   1.0.3                h1bed415_2    anaconda
libxcb                    1.14                 h7b6447c_0    anaconda
libxml2                   2.9.10               hb55368b_3    anaconda
lz4-c                     1.9.3                h2531618_0  
markupsafe                1.1.1            py38h7b6447c_0    anaconda
matplotlib                3.3.2                h06a4308_0  
matplotlib-base           3.3.2            py38h817c723_0  
mistune                   0.8.4           py38h7b6447c_1000    anaconda
mkl                       2020.2                      256  
mkl-service               2.3.0            py38he904b0f_0  
mkl_fft                   1.2.0            py38h23d657b_0  
mkl_random                1.1.1            py38h0573a6f_0  
nbclient                  0.5.1                      py_0    anaconda
nbconvert                 6.0.7                    py38_0    anaconda
nbformat                  5.0.8                      py_0    anaconda
ncurses                   6.2                  he6710b0_1  
nest-asyncio              1.4.1                      py_0    anaconda
netcdf4                   1.5.3            py38hbf33ddf_0  
notebook                  6.1.4                    py38_0    anaconda
numpy                     1.19.2           py38h54aff64_0  
numpy-base                1.19.2           py38hfa32c7d_0  
olefile                   0.46                       py_0  
openssl                   1.1.1i               h27cfd23_0  
owslib                    0.22.0             pyhd3eb1b0_0  
packaging                 20.4                       py_0    anaconda
pandas                    1.2.1            py38ha9443f7_0  
pandoc                    2.11                 hb0f4dca_0    anaconda
pandocfilters             1.4.2                    py38_1    anaconda
parso                     0.7.0                      py_0    anaconda
pcre                      8.44                 he6710b0_0    anaconda
pexpect                   4.8.0                    py38_0    anaconda
pickleshare               0.7.5                 py38_1000    anaconda
pillow                    8.1.0            py38he98fc37_0  
pip                       20.2.4           py38h06a4308_0  
proj                      6.2.1                haa6030c_0  
prometheus_client         0.8.0                      py_0    anaconda
prompt-toolkit            3.0.8                      py_0    anaconda
prompt_toolkit            3.0.8                         0    anaconda
ptyprocess                0.6.0                    py38_0    anaconda
pycosat                   0.6.3            py38h7b6447c_1  
pycparser                 2.20                       py_2  
pyepsg                    0.4.0                      py_0  
pygments                  2.7.1                      py_0    anaconda
pykdtree                  1.3.1           py38hdd07704_1002  
pyopenssl                 19.1.0             pyhd3eb1b0_1  
pyparsing                 2.4.7                      py_0    anaconda
pyproj                    2.6.1.post1      py38hd003209_1  
pyqt                      5.9.2            py38h05f1152_4    anaconda
pyrsistent                0.17.3           py38h7b6447c_0    anaconda
pyshp                     2.1.3              pyhd3eb1b0_0  
pysocks                   1.7.1            py38h06a4308_0  
python                    3.8.5                h7579374_1  
python-dateutil           2.8.1                      py_0    anaconda
pytz                      2020.5             pyhd3eb1b0_0  
pyyaml                    5.4.1            py38h27cfd23_1  
pyzmq                     19.0.2           py38he6710b0_1    anaconda
qt                        5.9.7                h5867ecd_1    anaconda
qtconsole                 4.7.7                      py_0    anaconda
qtpy                      1.9.0                      py_0    anaconda
readline                  8.0                  h7b6447c_0  
requests                  2.24.0                     py_0  
ruamel_yaml               0.15.87          py38h7b6447c_1  
scipy                     1.5.2            py38h0b6359f_0  
seaborn                   0.11.1             pyhd3eb1b0_0  
send2trash                1.5.0                    py38_0    anaconda
setuptools                50.3.1           py38h06a4308_1  
shapely                   1.7.1            py38h98ec03d_0  
sip                       4.19.24          py38he6710b0_0    anaconda
six                       1.15.0           py38h06a4308_0  
sqlite                    3.33.0               h62c20be_0  
terminado                 0.9.1                    py38_0    anaconda
testpath                  0.4.4                      py_0    anaconda
tk                        8.6.10               hbc83047_0  
tornado                   6.0.4            py38h7b6447c_1    anaconda
tqdm                      4.51.0             pyhd3eb1b0_0  
traitlets                 5.0.5                      py_0    anaconda
urllib3                   1.25.11                    py_0  
wcwidth                   0.2.5                      py_0    anaconda
webencodings              0.5.1                    py38_1    anaconda
wheel                     0.35.1             pyhd3eb1b0_0  
widgetsnbextension        3.5.1                    py38_0    anaconda
xarray                    0.16.2             pyhd3eb1b0_0  
xz                        5.2.5                h7b6447c_0  
yaml                      0.2.5                h7b6447c_0  
zeromq                    4.3.3                he6710b0_3    anaconda
zipp                      3.3.1                      py_0    anaconda
zlib                      1.2.11               h7b6447c_3  
zstd                      1.4.5                h9ceee32_0 

pip list

Package                Version
---------------------- -------------------
argon2-cffi            20.1.0
async-generator        1.10
attrs                  20.2.0
backcall               0.2.0
bleach                 3.2.1
brotlipy               0.7.0
Cartopy                0.18.0
certifi                2020.12.5
cffi                   1.14.3
cftime                 1.3.1
chardet                3.0.4
conda                  4.9.2
conda-package-handling 1.7.2
cryptography           3.2.1
cycler                 0.10.0
decorator              4.4.2
defusedxml             0.6.0
entrypoints            0.3
idna                   2.10
importlib-metadata     2.0.0
ipykernel              5.3.4
ipython                7.19.0
ipython-genutils       0.2.0
ipywidgets             7.5.1
jedi                   0.17.2
Jinja2                 2.11.2
jsonschema             3.2.0
jupyter                1.0.0
jupyter-client         6.1.7
jupyter-console        6.2.0
jupyter-core           4.6.3
jupyterlab-pygments    0.1.2
kiwisolver             1.3.0
MarkupSafe             1.1.1
matplotlib             3.3.2
mistune                0.8.4
mkl-fft                1.2.0
mkl-random             1.1.1
mkl-service            2.3.0
nbclient               0.5.1
nbconvert              6.0.7
nbformat               5.0.8
nest-asyncio           1.4.1
netCDF4                1.5.3
notebook               6.1.4
numpy                  1.19.2
olefile                0.46
OWSLib                 0.22.0
packaging              20.4
pandas                 1.2.1
pandocfilters          1.4.2
parso                  0.7.0
pexpect                4.8.0
pickleshare            0.7.5
Pillow                 8.1.0
pip                    20.2.4
prometheus-client      0.8.0
prompt-toolkit         3.0.8
ptyprocess             0.6.0
pycosat                0.6.3
pycparser              2.20
pyepsg                 0.4.0
Pygments               2.7.1
pykdtree               1.3.1
pyOpenSSL              19.1.0
pyparsing              2.4.7
pyproj                 2.6.1.post1
pyrsistent             0.17.3
pyshp                  2.1.3
PySocks                1.7.1
python-dateutil        2.8.1
pytz                   2020.5
PyYAML                 5.4.1
pyzmq                  19.0.2
qtconsole              4.7.7
QtPy                   1.9.0
requests               2.24.0
ruamel-yaml            0.15.87
scipy                  1.5.2
seaborn                0.11.1
Send2Trash             1.5.0
setuptools             50.3.1.post20201107
Shapely                1.7.1
sip                    4.19.24
six                    1.15.0
terminado              0.9.1
testpath               0.4.4
tornado                6.0.4
tqdm                   4.51.0
traitlets              5.0.5
urllib3                1.25.11
wcwidth                0.2.5
webencodings           0.5.1
wheel                  0.35.1
widgetsnbextension     3.5.1
xarray                 0.16.2
zipp                   3.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions