Skip to content

Commit fbf7fd1

Browse files
committed
Add loninline/latinline properties, default is False
1 parent db9407a commit fbf7fd1

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

docs/configuration.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,12 @@ Key Description
172172
``geogrid.labelpad`` Default padding in points between map boundary edge and longitude/latitude labels.
173173
``geogrid.labels`` Boolean, indicates whether to label the parallels and meridians.
174174
``geogrid.labelsize`` Font size for latitude and longitude labels. Inherits from ``small``.
175+
``geogrid.latinline`` Whether default cartopy latitude gridlines should be inline. Set to ``None`` to use cartopy's `auto_inline`.
175176
``geogrid.latmax`` Absolute latitude in degrees, poleward of which meridian gridlines are cut off.
176177
``geogrid.latstep`` Default interval for parallel gridlines in degrees.
177178
``geogrid.linestyle`` Line style for geographic gridlines.
178-
``geogrid.linewidth`` line width for geographic gridlines.
179+
``geogrid.linewidth`` Line width for geographic gridlines.
180+
``geogrid.loninline`` Whether default cartopy longitude gridlines should be inline. Set to ``None`` to use cartopy's `auto_inline`.
179181
``geogrid.lonstep`` Default interval for meridian gridlines in degrees.
180182
``geogrid.rotatelabels`` Whether to rotate meridian and parallel gridline labels on cartopy axes.
181183
``gridminor.linewidth`` Minor gridline width.

proplot/axes/geo.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def format(
267267
)
268268
super().format(**kwargs)
269269

270-
def _get_latlines(self, step, latmax=None, user=None, **kwargs):
270+
def _get_latlines(self, step, latmax=None):
271271
"""
272272
Get latitude lines every `step` degrees.
273273
"""
@@ -287,7 +287,7 @@ def _get_latlines(self, step, latmax=None, user=None, **kwargs):
287287
latlines = np.append(-latlines[::-1], latlines[1:])
288288
return list(latlines)
289289

290-
def _get_lonlines(self, step, lon0=None, user=None, **kwargs):
290+
def _get_lonlines(self, step, lon0=None):
291291
"""
292292
Get longitude lines every `step` degrees.
293293
"""
@@ -434,6 +434,7 @@ def _format_apply(
434434
Apply formatting to cartopy axes. Extra kwargs are used to update proj4 params.
435435
"""
436436
latmax # prevent U100 error (cartopy handles 'latmax' automatically)
437+
lonlines_kw, latlines_kw # preven U100 error (these were already applied)
437438
import cartopy.feature as cfeature
438439
import cartopy.crs as ccrs
439440
from cartopy.mpl import ticker
@@ -577,7 +578,7 @@ def _add_gridline_label(self, value, axis, upper_end):
577578
extent = [*lonlim, *latlim]
578579
self.set_extent(extent, crs=ccrs.PlateCarree())
579580

580-
# Gridline properties including an axes.axisbelow-mimicking property
581+
# Gridline collection properties including axes.axisbelow-mimicking property
581582
kw = rc.fill({
582583
'alpha': 'geogrid.alpha',
583584
'color': 'geogrid.color',
@@ -596,9 +597,17 @@ def _add_gridline_label(self, value, axis, upper_end):
596597
raise ValueError(f'Unexpected geogrid.axisbelow value {axisbelow!r}.')
597598
kw['zorder'] = zorder
598599
gl.collection_kwargs.update(kw)
600+
601+
# Special gridline properties
599602
pad = rc.get('geogrid.labelpad', context=True)
600603
if pad is not None:
601604
gl.xpadding = gl.ypadding = pad
605+
loninline = rc.get('geogrid.loninline', context=True)
606+
if loninline is not None:
607+
gl.x_inline = loninline
608+
latinline = rc.get('geogrid.latinline', context=True)
609+
if latinline is not None:
610+
gl.y_inline = latinline
602611

603612
# Gridline longitudes and latitudes
604613
eps = 1e-10
@@ -904,11 +913,17 @@ def _get_lon_0(self, step=5):
904913

905914
def _get_lonlines(self, step, user=False, **kwargs):
906915
"""Get longitude line locations given the input step."""
916+
user, kwargs # prevent U100 error (this is used in cartopy subclass)
907917
# Locations do not have to wrap around like they do in cartopy
908918
lonlines = super()._get_lonlines(step)
909919
lonlines = lonlines[:-1]
910920
return lonlines
911921

922+
def _get_latlines(self, step, latmax=None, user=False, **kwargs):
923+
"""Get latitude line locations given the input step."""
924+
user, kwargs # prevent U100 error (these are used in cartopy subclass)
925+
return super()._get_latlines(step, latmax=latmax)
926+
912927
def _format_apply(
913928
self, *, patch_kw,
914929
lonlim, latlim, boundinglat,

0 commit comments

Comments
 (0)