Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Geo projections getting clobbered by 2to3 when used when python3 #1555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
Renamed all instances of variables named "long" to "lon" to avoid clo…
…bbering by 2to3
  • Loading branch information
joferkington committed Dec 4, 2012
commit 5fb0a5792320de7e5aeead290abeb2f48f4bcd46
8 changes: 4 additions & 4 deletions 8 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 12 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.