Skip to content

Commit

Permalink
added option to print latitudes for Southern hemisphere
Browse files Browse the repository at this point in the history
  • Loading branch information
klaundal committed Mar 29, 2024
1 parent f6d53e2 commit f5d4fd6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/polplot/polplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def writeLTlabels(self, lat = None, degrees = False, **kwargs):
return labels


def writeLATlabels(self, lt=3, lats=None, rotation=45, color='lightgrey', backgroundcolor='white', zorder=2, **kwargs):
def writeLATlabels(self, lt=3, lats=None, rotation=45, north = True, color='lightgrey', backgroundcolor='white', zorder=2, **kwargs):
"""
Write latitude labels at a specified meridian.
Expand All @@ -335,6 +335,8 @@ def writeLATlabels(self, lt=3, lats=None, rotation=45, color='lightgrey', backgr
Longitude for placing the labels.
rotation : int, default 45
Text rotation angle.
north : bool, default True
Set to False to add a minus sign for the labels
color : str, default 'lightgrey'
Text color. Set to (0, 0, 0, 0) to disable background
backgroundcolor : str, default 'white'
Expand All @@ -353,10 +355,12 @@ def writeLATlabels(self, lt=3, lats=None, rotation=45, color='lightgrey', backgr

labels = []

sign = '' if north else '-'

if not lats:
lats=np.r_[80:self.minlat-1e-12:-10][::-1].astype('int64')
for lat in lats:
labels.append(self.write(lat, lt, f'{lat}°', ignore_plot_limits = False, **label_params))
labels.append(self.write(lat, lt, sign + f'{lat}°', ignore_plot_limits = False, **label_params))
if self.lat_labels:
try:
for label in self.lat_labels:
Expand Down

0 comments on commit f5d4fd6

Please sign in to comment.