Skip to content

Commit 3e9ae52

Browse files
author
Jeff Whitaker
committed
Merge pull request #61 from jswhit/master
python 3 fixes for examples
2 parents b756588 + 60e07d9 commit 3e9ae52

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

examples/customticks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import unicode_literals
12
from mpl_toolkits.basemap import Basemap
23
import numpy as np
34
import matplotlib.pyplot as plt
@@ -15,7 +16,7 @@ def lat2str(deg):
1516
deg += 1.0
1617
min -= 60.0
1718
dir = 'S'
18-
return (u"%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
19+
return ("%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
1920

2021
def lon2str(deg):
2122
min = 60 * (deg - np.floor(deg))
@@ -26,7 +27,7 @@ def lon2str(deg):
2627
deg += 1.0
2728
min -= 60.0
2829
dir = 'W'
29-
return (u"%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
30+
return ("%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
3031

3132
# (1) use matplotlib custom tick formatter
3233
# instead of Basemap labelling methods.

examples/fcstmaps_axesgrid.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import print_function
2+
from __future__ import unicode_literals
23
# this example reads today's numerical weather forecasts
34
# from the NOAA OpenDAP servers and makes a multi-panel plot.
45
# This version demonstrates the use of the AxesGrid toolkit.
@@ -100,7 +101,7 @@
100101
ax.set_title('%d-h forecast valid '%fcsthr+verifdates[nt],fontsize=9)
101102
# figure title
102103
plt.figtext(0.5,0.95,
103-
u"2-m temp (\N{DEGREE SIGN}C) forecasts from %s"%verifdates[0],
104+
"2-m temp (\N{DEGREE SIGN}C) forecasts from %s"%verifdates[0],
104105
horizontalalignment='center',fontsize=14)
105106
# a single colorbar.
106107
cbar = fig.colorbar(cs, cax=grid.cbar_axes[0], orientation='horizontal')

0 commit comments

Comments
 (0)