Skip to content

Commit 2f5e568

Browse files
committed
Refactor some x/y names in gridliner + use new locators and formatters
1 parent 924fd87 commit 2f5e568

File tree

3 files changed

+144
-117
lines changed

3 files changed

+144
-117
lines changed

lib/cartopy/mpl/geoaxes.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,8 +1161,8 @@ def imshow(self, img, *args, **kwargs):
11611161
# result.set_clip_path(self.outline_patch)
11621162
return result
11631163

1164-
def gridlines(self, crs=None, draw_labels=False, xlocs=None,
1165-
ylocs=None, **kwargs):
1164+
def gridlines(self, crs=None, draw_labels=False, mlocs=None,
1165+
plocs=None, **kwargs):
11661166
"""
11671167
Automatically add gridlines to the axes, in the given coordinate
11681168
system, at draw time.
@@ -1175,17 +1175,17 @@ def gridlines(self, crs=None, draw_labels=False, xlocs=None,
11751175
Defaults to :class:`cartopy.crs.PlateCarree`.
11761176
draw_labels: optional
11771177
Label gridlines like axis ticks, around the edge.
1178-
xlocs: optional
1178+
mlocs: optional
11791179
An iterable of gridline locations or a
11801180
:class:`matplotlib.ticker.Locator` instance which will be
1181-
used to determine the locations of the gridlines in the
1182-
x-coordinate of the given CRS. Defaults to None, which
1181+
used to determine the locations of the meridian gridlines in the
1182+
coordinate of the given CRS. Defaults to None, which
11831183
implies automatic locating of the gridlines.
1184-
ylocs: optional
1184+
plocs: optional
11851185
An iterable of gridline locations or a
11861186
:class:`matplotlib.ticker.Locator` instance which will be
1187-
used to determine the locations of the gridlines in the
1188-
y-coordinate of the given CRS. Defaults to None, which
1187+
used to determine the locations of the parallel gridlines in the
1188+
coordinate of the given CRS. Defaults to None, which
11891189
implies automatic locating of the gridlines.
11901190
11911191
Returns
@@ -1202,13 +1202,9 @@ def gridlines(self, crs=None, draw_labels=False, xlocs=None,
12021202
if crs is None:
12031203
crs = ccrs.PlateCarree()
12041204
from cartopy.mpl.gridliner import Gridliner
1205-
if xlocs is not None and not isinstance(xlocs, mticker.Locator):
1206-
xlocs = mticker.FixedLocator(xlocs)
1207-
if ylocs is not None and not isinstance(ylocs, mticker.Locator):
1208-
ylocs = mticker.FixedLocator(ylocs)
12091205
gl = Gridliner(
1210-
self, crs=crs, draw_labels=draw_labels, xlocator=xlocs,
1211-
ylocator=ylocs, collection_kwargs=kwargs)
1206+
self, crs=crs, draw_labels=draw_labels, mlocator=mlocs,
1207+
plocator=plocs, collection_kwargs=kwargs)
12121208
self._gridliners.append(gl)
12131209
return gl
12141210

0 commit comments

Comments
 (0)