Skip to content

Commit

Permalink
Handle direction_label directly in PlateCarreeFormatter
Browse files Browse the repository at this point in the history
  • Loading branch information
gcaria committed Sep 29, 2020
1 parent 0275406 commit 29a7e8f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/cartopy/mpl/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def __init__(self, direction_label=True,
"""
super().__init__(
direction_label=direction_label,
degree_symbol=degree_symbol,
number_format=number_format,
transform_precision=transform_precision,
Expand All @@ -285,16 +286,11 @@ def __init__(self, direction_label=True,
auto_hide=auto_hide,
)

self._direction_labels = direction_label

def _apply_transform(self, value, target_proj, source_crs):
return target_proj.transform_point(0, value, source_crs)[1]

def _hemisphere(self, value, value_source_crs):

if not self._direction_labels:
return ''

if value > 0:
hemisphere = 'N'
elif value < 0:
Expand Down Expand Up @@ -403,6 +399,7 @@ def __init__(self,
labels = [lon_formatter(value) for value in ticks]
"""
super().__init__(
direction_label=direction_label,
degree_symbol=degree_symbol,
number_format=number_format,
transform_precision=transform_precision,
Expand All @@ -412,7 +409,6 @@ def __init__(self,
seconds_number_format=seconds_number_format,
auto_hide=auto_hide,
)
self._direction_labels = direction_label
self._zero_direction_labels = zero_direction_label
self._dateline_direction_labels = dateline_direction_label

Expand Down Expand Up @@ -447,9 +443,6 @@ def _format_degrees(self, deg):

def _hemisphere(self, value, value_source_crs):

if not self._direction_labels:
return ''

value = self._fix_lons(value)
# Perform basic hemisphere detection.
if value < 0:
Expand Down

0 comments on commit 29a7e8f

Please sign in to comment.