Skip to content

Commit

Permalink
Let cartopy issue warning if projection labels impossible
Browse files Browse the repository at this point in the history
  • Loading branch information
lukelbd committed Sep 18, 2019
1 parent 8e6dfc9 commit 440dd7e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions proplot/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2957,13 +2957,14 @@ def _format_apply(self, patch_kw, lonlim, latlim, boundinglat,
latlines[-1] -= eps
gl.ylocator = mticker.FixedLocator(latlines)
# Grid label toggling
if not isinstance(self.projection, (ccrs.Mercator, ccrs.PlateCarree)):
if latarray is not None and any(latarray):
warnings.warn(f'Cannot add gridline labels on cartopy {self.projection} projection.')
latarray = [0]*4
if lonarray is not None and any(lonarray):
warnings.warn(f'Cannot add gridline labels on cartopy {self.projection} projection.')
lonarray = [0]*4
# Let cartopy issue warning when no labels possible
# if not isinstance(self.projection, (ccrs.Mercator, ccrs.PlateCarree)):
# if latarray is not None and any(latarray):
# warnings.warn(f'Cannot add gridline labels on cartopy {self.projection} projection.')
# latarray = [0]*4
# if lonarray is not None and any(lonarray):
# warnings.warn(f'Cannot add gridline labels on cartopy {self.projection} projection.')
# lonarray = [0]*4
if latarray is not None:
gl.ylabels_left = latarray[0]
gl.ylabels_right = latarray[1]
Expand Down

0 comments on commit 440dd7e

Please sign in to comment.