Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/api/custom_projection_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,25 +262,25 @@ def set_xlim(self, *args, **kwargs):
Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0)
set_ylim = set_xlim

def format_coord(self, long, lat):
def format_coord(self, lon, lat):
"""
Override this method to change how the values are displayed in
the status bar.

In this case, we want them to be displayed in degrees N/S/E/W.
"""
long = long * (180.0 / np.pi)
lon = lon * (180.0 / np.pi)
lat = lat * (180.0 / np.pi)
if lat >= 0.0:
ns = 'N'
else:
ns = 'S'
if long >= 0.0:
if lon >= 0.0:
ew = 'E'
else:
ew = 'W'
# \u00b0 : degree symbol
return '%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(long), ew)
return '%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(lon), ew)

class DegreeFormatter(Formatter):
"""
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/projections/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,19 @@ def set_xlim(self, *args, **kwargs):

set_ylim = set_xlim

def format_coord(self, long, lat):
def format_coord(self, lon, lat):
'return a format string formatting the coordinate'
long = long * (180.0 / np.pi)
lon = lon * (180.0 / np.pi)
lat = lat * (180.0 / np.pi)
if lat >= 0.0:
ns = 'N'
else:
ns = 'S'
if long >= 0.0:
if lon >= 0.0:
ew = 'E'
else:
ew = 'W'
return u'%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(long), ew)
return u'%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(lon), ew)

def set_longitude_grid(self, degrees):
"""
Expand Down Expand Up @@ -576,10 +576,10 @@ def transform_non_affine(self, xy):

lat = np.arcsin(cos_c*np.sin(clat) +
((y*sin_c*np.cos(clat)) / p))
long = clong + np.arctan(
lon = clong + np.arctan(
(x*sin_c) / (p*np.cos(clat)*cos_c - y*np.sin(clat)*sin_c))

return np.concatenate((long, lat), 1)
return np.concatenate((lon, lat), 1)
transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__

def inverted(self):
Expand Down