Skip to content

Commit c3f2b08

Browse files
committed
Add geoaxes format kwargs
1 parent 6c50664 commit c3f2b08

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

proplot/axes/geo.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ def format(
7878
latlines=None, latlocator=None, latmax=None,
7979
lonlines_kw=None, lonlocator_kw=None,
8080
latlines_kw=None, latlocator_kw=None,
81+
lonformatter=None, latformatter=None,
82+
lonformatter_kw=None, latformatter_kw=None,
83+
rotate_labels=None,
8184
labels=None, latlabels=None, lonlabels=None,
8285
patch_kw=None, **kwargs,
8386
):
@@ -105,6 +108,25 @@ def format(
105108
Otherwise, should be a `~matplotlib.ticker.Locator` instance.
106109
lonlocator, latlocator : optional
107110
Aliases for `lonlines`, `latlines`.
111+
lonlines_kw, latlines_kw : dict, optional
112+
Keyword argument dictionaries passed to the
113+
`~cartopy.mpl.ticker.LongitudeFormatter` and
114+
`~cartopy.mpl.ticker.LatitudeFormatter` formatters (respectively) for
115+
cartopy axes, or passed to `~mpl_toolkits.basemap.Basemap.drawmeridians`
116+
and `~mpl_toolkits.basemap.Basemap.drawparallels` methods (respectively)
117+
for basemap axes.
118+
lonlocator_kw, latlocator_kw : optional
119+
Aliases for `lonlines_kw`, `latlines_kw`.
120+
lonformatter, latformatter : `~matplotlib.ticker.Formatter`, optional
121+
`~matplotlib.ticker.Formatter` instances used to style longitude
122+
and latitude tick labels. For cartopy axes only.
123+
lonformatter_kw, latformatter_kw : optional
124+
Keyword arguments passed to `~cartopy.mpl.ticker.LongitudeFormatter`
125+
and `~cartopy.mpl.ticker.LatitudeFormatter`. Ignored if `lonformatter`
126+
or `latformatter` was provided. For cartopy axes only.
127+
rotate_labels : bool, optional
128+
Whether to rotate longitude and latitude gridline labels. For cartopy
129+
axes only. Default is :rc:`geogrid.rotatelabels`.
108130
latmax : float, optional
109131
The maximum absolute latitude for meridian gridlines. Default is
110132
:rc:`geogrid.latmax`.
@@ -172,10 +194,11 @@ def format(
172194
latlines_kw = _not_none(
173195
latlines_kw=latlines_kw, latlocator_kw=latlocator_kw, default={},
174196
)
175-
latlines = _not_none(
176-
latlines=latlines, latlocator=latlocator,
177-
default=rc.get('geogrid.latstep', context=True),
197+
rotate_labels = _not_none(
198+
rotate_labels, rc.get('geogrid.rotatelabels', context=True)
178199
)
200+
lonformatter_kw = lonformatter_kw or {}
201+
latformatter_kw = latformatter_kw or {}
179202
latmax = _not_none(latmax, rc.get('geogrid.latmax', context=True))
180203
labels = _not_none(labels, rc.get('geogrid.labels', context=True))
181204
grid = _not_none(grid, rc.get('geogrid', context=True))
@@ -236,8 +259,12 @@ def format(
236259
self._format_apply(
237260
patch_kw=patch_kw,
238261
boundinglat=boundinglat, lonlim=lonlim, latlim=latlim,
239-
lonlines=lonlines, latlines=latlines, latmax=latmax,
240-
lonarray=lonarray, latarray=latarray,
262+
lonlines=lonlines, latlines=latlines,
263+
lonlines_kw=lonlines_kw, latlines_kw=latlines_kw,
264+
lonformatter=lonformatter, latformatter=latformatter,
265+
lonformatter_kw=lonformatter_kw, latformatter_kw=latformatter_kw,
266+
rotate_labels=rotate_labels,
267+
latmax=latmax, lonarray=lonarray, latarray=latarray,
241268
)
242269
super().format(**kwargs)
243270

0 commit comments

Comments
 (0)