Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiding part of gridline labels #1383

Closed
paalge opened this issue Oct 11, 2019 · 2 comments · Fixed by #1507
Closed

Hiding part of gridline labels #1383

paalge opened this issue Oct 11, 2019 · 2 comments · Fixed by #1507
Milestone

Comments

@paalge
Copy link

paalge commented Oct 11, 2019

Description

I am running the latest master branch 0e5eef8 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

Full environment definition

Operating system

Linux Mint 19.2

Cartopy version

0e5eef8

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)

@dopplershift
Copy link
Contributor

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

@greglucas
Copy link
Contributor

Just looked into this. This is because the label attributes were apparently changed. They are now bottom_labels, etc... instead of with the x/y qualifiers. I just made a PR to hopefully allow some deprecation with this as I didn't see any documentation for this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants