diff --git a/examples/animation/simple_3danim.py b/examples/animation/simple_3danim.py
index 7cb69b7..823cbaf 100644
--- a/examples/animation/simple_3danim.py
+++ b/examples/animation/simple_3danim.py
@@ -15,7 +15,7 @@ def Gen_RandLine(length, dims=2) :
     """
     lineData = np.empty((dims, length))
     lineData[:, 0] = np.random.rand(1, dims)
-    for index in xrange(1, length) :
+    for index in range(1, length) :
         # scaling the random numbers by 0.1 so
         # movement is small compared to position.
         # subtraction by 0.5 is to change the range to [-0.5, 0.5]
@@ -37,7 +37,7 @@ fig = plt.figure()
 ax = p3.Axes3D(fig)
 
 # Fifty lines of random 3-D lines
-data = [Gen_RandLine(25, 3) for index in xrange(50)]
+data = [Gen_RandLine(25, 3) for index in range(50)]
 
 # Creating fifty line objects.
 # NOTE: Can't pass empty arrays into 3d version of plot()
diff --git a/examples/api/collections_demo.py b/examples/api/collections_demo.py
index b4dbf61..de56006 100644
--- a/examples/api/collections_demo.py
+++ b/examples/api/collections_demo.py
@@ -30,13 +30,13 @@ r = N.array(range(nverts))
 theta = N.array(range(nverts)) * (2*N.pi)/(nverts-1)
 xx = r * N.sin(theta)
 yy = r * N.cos(theta)
-spiral = zip(xx,yy)
+spiral = list(zip(xx,yy))
 
 # Make some offsets
 rs = N.random.RandomState([12345678])
 xo = rs.randn(npts)
 yo = rs.randn(npts)
-xyo = zip(xo, yo)
+xyo = list(zip(xo, yo))
 
 # Make a list of colors cycling through the rgbcmyk series.
 colors = [colorConverter.to_rgba(c) for c in ('r','g','b','c','y','m','k')]
@@ -114,7 +114,7 @@ xx = (0.2 + (ym-yy)/ym)**2 * N.cos(yy-0.4) * 0.5
 segs = []
 for i in range(ncurves):
     xxx = xx + 0.02*rs.randn(nverts)
-    curve = zip(xxx, yy*100)
+    curve = list(zip(xxx, yy*100))
     segs.append(curve)
 
 col = collections.LineCollection(segs, offsets=offs)
diff --git a/examples/api/custom_projection_example.py b/examples/api/custom_projection_example.py
index 777f437..0fdf121 100644
--- a/examples/api/custom_projection_example.py
+++ b/examples/api/custom_projection_example.py
@@ -279,8 +279,8 @@ class HammerAxes(Axes):
             ew = 'E'
         else:
             ew = 'W'
-        # \u00b0 : degree symbol
-        return u'%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(long), ew)
+        # \xc2\xb0 : degree symbol
+        return (b'%f\xc2\xb0%s, %f\xc2\xb0%s'.decode('utf8')) % (abs(lat), ns, abs(long), ew)
 
     class DegreeFormatter(Formatter):
         """
@@ -294,7 +294,7 @@ class HammerAxes(Axes):
             degrees = (x / np.pi) * 180.0
             degrees = round(degrees / self._round_to) * self._round_to
             # \u00b0 : degree symbol
-            return u"%d\u00b0" % degrees
+            return (b"%d\xc2\xb0".decode('utf8')) % degrees
 
     def set_longitude_grid(self, degrees):
         """
diff --git a/examples/api/custom_scale_example.py b/examples/api/custom_scale_example.py
index d7700fd..79a1a53 100644
--- a/examples/api/custom_scale_example.py
+++ b/examples/api/custom_scale_example.py
@@ -66,8 +66,8 @@ class MercatorLatitudeScale(mscale.ScaleBase):
         """
         class DegreeFormatter(Formatter):
             def __call__(self, x, pos=None):
-                # \u00b0 : degree symbol
-                return u"%d\u00b0" % ((x / np.pi) * 180.0)
+                # \xc2\xb0 : degree symbol
+                return b"%d\xc2\xb0".decode('utf8') % ((x / np.pi) * 180.0)
 
         deg2rad = np.pi / 180.0
         axis.set_major_locator(FixedLocator(
diff --git a/examples/api/date_index_formatter.py b/examples/api/date_index_formatter.py
index 4eb2429..8db2378 100644
--- a/examples/api/date_index_formatter.py
+++ b/examples/api/date_index_formatter.py
@@ -10,7 +10,7 @@ import matplotlib.cbook as cbook
 import matplotlib.ticker as ticker
 
 datafile = cbook.get_sample_data('aapl.csv', asfileobj=False)
-print 'loading', datafile
+print ('loading %s' % datafile)
 r = mlab.csv2rec(datafile)
 
 r.sort()
diff --git a/examples/api/scatter_piecharts.py b/examples/api/scatter_piecharts.py
index 89bbb51..48997fb 100644
--- a/examples/api/scatter_piecharts.py
+++ b/examples/api/scatter_piecharts.py
@@ -20,16 +20,16 @@ sizes = [60,80,120]
 # some points on a circle cos,sin
 x = [0] + np.cos(np.linspace(0, 2*math.pi*r1, 10)).tolist()
 y = [0] + np.sin(np.linspace(0, 2*math.pi*r1, 10)).tolist()
-xy1 = zip(x,y)
+xy1 = list(zip(x,y))
 
 # ...
 x = [0] + np.cos(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist()
 y = [0] + np.sin(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist()
-xy2 = zip(x,y)
+xy2 = list(zip(x,y))
 
 x = [0] + np.cos(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist()
 y = [0] + np.sin(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist()
-xy3 = zip(x,y)
+xy3 = list(zip(x,y))
 
 
 fig = plt.figure()
diff --git a/examples/api/watermark_image.py b/examples/api/watermark_image.py
index 7affe16..630bba0 100644
--- a/examples/api/watermark_image.py
+++ b/examples/api/watermark_image.py
@@ -8,7 +8,7 @@ import matplotlib.image as image
 import matplotlib.pyplot as plt
 
 datafile = cbook.get_sample_data('logo2.png', asfileobj=False)
-print 'loading', datafile
+print ('loading %s' % datafile)
 im = image.imread(datafile)
 im[:,:,-1] = 0.5  # set the alpha channel
 
diff --git a/examples/mplot3d/polys3d_demo.py b/examples/mplot3d/polys3d_demo.py
index cd2aaa0..ed64d3a 100644
--- a/examples/mplot3d/polys3d_demo.py
+++ b/examples/mplot3d/polys3d_demo.py
@@ -15,7 +15,7 @@ zs = [0.0, 1.0, 2.0, 3.0]
 for z in zs:
     ys = np.random.rand(len(xs))
     ys[0], ys[-1] = 0, 0
-    verts.append(zip(xs, ys))
+    verts.append(list(zip(xs, ys)))
 
 poly = PolyCollection(verts, facecolors = [cc('r'), cc('g'), cc('b'),
                                            cc('y')])
diff --git a/examples/mplot3d/wire3d_animation_demo.py b/examples/mplot3d/wire3d_animation_demo.py
index dc654f3..933cf4e 100644
--- a/examples/mplot3d/wire3d_animation_demo.py
+++ b/examples/mplot3d/wire3d_animation_demo.py
@@ -34,4 +34,4 @@ for phi in np.linspace(0, 360 / 2 / np.pi, 100):
 
     plt.draw()
 
-print 'FPS: %f' % (100 / (time.time() - tstart))
+print ('FPS: %f' % (100 / (time.time() - tstart)))
diff --git a/examples/pylab_examples/anscombe.py b/examples/pylab_examples/anscombe.py
index ab045b9..5d544f8 100644
--- a/examples/pylab_examples/anscombe.py
+++ b/examples/pylab_examples/anscombe.py
@@ -52,6 +52,6 @@ text(3,12, 'IV', fontsize=20)
 #verify the stats
 pairs = (x,y1), (x,y2), (x,y3), (x4,y4)
 for x,y in pairs:
-    print 'mean=%1.2f, std=%1.2f, r=%1.2f'%(mean(y), std(y), corrcoef(x,y)[0][1])
+    print ('mean=%1.2f, std=%1.2f, r=%1.2f'%(mean(y), std(y), corrcoef(x,y)[0][1]))
 
 show()
diff --git a/examples/pylab_examples/arrow_demo.py b/examples/pylab_examples/arrow_demo.py
index 232193e..d75470e 100644
--- a/examples/pylab_examples/arrow_demo.py
+++ b/examples/pylab_examples/arrow_demo.py
@@ -199,7 +199,7 @@ def make_arrow_plot(data, size=4, display='length', shape='right', \
         elif where == 'center':
             orig_position = array([[length/2.0, 3*max_arrow_width]])
         else:
-            raise ValueError, "Got unknown position parameter %s" % where
+            raise ValueError("Got unknown position parameter %s" % where)
 
 
 
diff --git a/examples/pylab_examples/coords_demo.py b/examples/pylab_examples/coords_demo.py
index 9349b6d..7c590b0 100644
--- a/examples/pylab_examples/coords_demo.py
+++ b/examples/pylab_examples/coords_demo.py
@@ -18,20 +18,20 @@ def on_move(event):
 
     if event.inaxes:
         ax = event.inaxes  # the axes instance
-        print 'data coords', event.xdata, event.ydata
+        print ('data coords %f %f' % (event.xdata, event.ydata))
 
 def on_click(event):
     # get the x and y coords, flip y from top to bottom
     x, y = event.x, event.y
     if event.button==1:
         if event.inaxes is not None:
-            print 'data coords', event.xdata, event.ydata
+            print ('data coords %f %f' % (event.xdata, event.ydata))
 
 binding_id = connect('motion_notify_event', on_move)
 connect('button_press_event', on_click)
 
 if "test_disconnect" in sys.argv:
-    print "disconnecting console coordinate printout..."
+    print ("disconnecting console coordinate printout...")
     disconnect(binding_id)
 
 show()
diff --git a/examples/pylab_examples/cursor_demo.py b/examples/pylab_examples/cursor_demo.py
index c4342d2..bb7dbc3 100644
--- a/examples/pylab_examples/cursor_demo.py
+++ b/examples/pylab_examples/cursor_demo.py
@@ -61,7 +61,7 @@ class SnaptoCursor:
         self.ly.set_xdata(x )
 
         self.txt.set_text( 'x=%1.2f, y=%1.2f'%(x,y) )
-        print 'x=%1.2f, y=%1.2f'%(x,y)
+        print ('x=%1.2f, y=%1.2f'%(x,y))
         draw()
 
 t = arange(0.0, 1.0, 0.01)
diff --git a/examples/pylab_examples/dashpointlabel.py b/examples/pylab_examples/dashpointlabel.py
index d383ff6..fe5149d 100644
--- a/examples/pylab_examples/dashpointlabel.py
+++ b/examples/pylab_examples/dashpointlabel.py
@@ -21,7 +21,7 @@ ax = fig.add_subplot(111)
 
 (x,y) = zip(*DATA)
 ax.plot(x, y, marker='o')
-for i in xrange(len(DATA)):
+for i in range(len(DATA)):
     (x,y) = DATA[i]
     (dd, dl, r, dr, dp) = dash_style[i]
     #print 'dashlen call', dl
diff --git a/examples/pylab_examples/data_helper.py b/examples/pylab_examples/data_helper.py
index d58823c..e40ae2e 100644
--- a/examples/pylab_examples/data_helper.py
+++ b/examples/pylab_examples/data_helper.py
@@ -13,11 +13,11 @@ def get_two_stock_data():
 
     file1 = cbook.get_sample_data('INTC.dat', asfileobj=False)
     file2 = cbook.get_sample_data('AAPL.dat', asfileobj=False)
-    M1 = fromstring( file(file1, 'rb').read(), '<d')
+    M1 = fromstring( open(file1, 'rb').read(), '<d')
 
     M1 = resize(M1, (M1.shape[0]/2,2) )
 
-    M2 = fromstring( file(file2, 'rb').read(), '<d')
+    M2 = fromstring( open(file2, 'rb').read(), '<d')
     M2 = resize(M2, (M2.shape[0]/2,2) )
 
     d1, p1 = M1[:,0], M1[:,1]
@@ -41,7 +41,7 @@ def get_daily_data():
 
         datafile = cbook.get_sample_data('%s.csv'%ticker, asfileobj=False)
 
-        lines = file(datafile).readlines()
+        lines = open(datafile).readlines()
         for line in lines[1:]:
             vals.append([float(val) for val in line.split(',')[1:]])
 
diff --git a/examples/pylab_examples/date_demo2.py b/examples/pylab_examples/date_demo2.py
index 28363a1..c1e3408 100644
--- a/examples/pylab_examples/date_demo2.py
+++ b/examples/pylab_examples/date_demo2.py
@@ -24,7 +24,7 @@ monthsFmt = DateFormatter("%b '%y")
 
 quotes = quotes_historical_yahoo('INTC', date1, date2)
 if len(quotes) == 0:
-    print 'Found no quotes'
+    print ('Found no quotes')
     raise SystemExit
 
 dates = [q[0] for q in quotes]
diff --git a/examples/pylab_examples/date_index_formatter.py b/examples/pylab_examples/date_index_formatter.py
index e5ba7e3..9412a9f 100644
--- a/examples/pylab_examples/date_index_formatter.py
+++ b/examples/pylab_examples/date_index_formatter.py
@@ -15,7 +15,7 @@ import matplotlib.cbook as cbook
 from matplotlib.ticker import Formatter
 
 datafile = cbook.get_sample_data('msft.csv', asfileobj=False)
-print 'loading', datafile
+print ('loading %s' % datafile)
 r = csv2rec(datafile)[-40:]
 
 class MyFormatter(Formatter):
diff --git a/examples/pylab_examples/ellipse_demo.py b/examples/pylab_examples/ellipse_demo.py
index a547960..866c9c0 100644
--- a/examples/pylab_examples/ellipse_demo.py
+++ b/examples/pylab_examples/ellipse_demo.py
@@ -4,7 +4,7 @@ from matplotlib.patches import Ellipse
 NUM = 250
 
 ells = [Ellipse(xy=rand(2)*10, width=rand(), height=rand(), angle=rand()*360)
-        for i in xrange(NUM)]
+        for i in range(NUM)]
 
 fig = figure()
 ax = fig.add_subplot(111, aspect='equal')
diff --git a/examples/pylab_examples/image_demo2.py b/examples/pylab_examples/image_demo2.py
index 50e994f..00a5fd1 100644
--- a/examples/pylab_examples/image_demo2.py
+++ b/examples/pylab_examples/image_demo2.py
@@ -5,8 +5,8 @@ import matplotlib.cbook as cbook
 w, h = 512, 512
 
 datafile = cbook.get_sample_data('ct.raw', asfileobj=False)
-print 'loading', datafile
-s = file(datafile, 'rb').read()
+print ('loading %s' % datafile)
+s = open(datafile, 'rb').read()
 A = fromstring(s, uint16).astype(float)
 A *= 1.0/max(A)
 A.shape = w, h
diff --git a/examples/pylab_examples/image_demo3.py b/examples/pylab_examples/image_demo3.py
index ba1c701..26b6fe9 100644
--- a/examples/pylab_examples/image_demo3.py
+++ b/examples/pylab_examples/image_demo3.py
@@ -2,7 +2,7 @@
 from pylab import *
 try:
     from PIL import Image
-except ImportError, exc:
+except ImportError:
     raise SystemExit("PIL must be installed to run this example")
 
 import matplotlib.cbook as cbook
diff --git a/examples/pylab_examples/image_slices_viewer.py b/examples/pylab_examples/image_slices_viewer.py
index a9c1b78..fec30db 100644
--- a/examples/pylab_examples/image_slices_viewer.py
+++ b/examples/pylab_examples/image_slices_viewer.py
@@ -17,7 +17,7 @@ class IndexTracker:
         self.update()
 
     def onscroll(self, event):
-        print event.button, event.step
+        print ("%s %s" % (event.button, event.step))
         if event.button=='up':
             self.ind = numpy.clip(self.ind+1, 0, self.slices-1)
         else:
diff --git a/examples/pylab_examples/integral_demo.py b/examples/pylab_examples/integral_demo.py
index a9b0226..436482c 100644
--- a/examples/pylab_examples/integral_demo.py
+++ b/examples/pylab_examples/integral_demo.py
@@ -17,7 +17,7 @@ plot(x, y, linewidth=1)
 # make the shaded region
 ix = arange(a, b, 0.01)
 iy = func(ix)
-verts = [(a,0)] + zip(ix,iy) + [(b,0)]
+verts = [(a,0)] + list(zip(ix,iy)) + [(b,0)]
 poly = Polygon(verts, facecolor='0.8', edgecolor='k')
 ax.add_patch(poly)
 
diff --git a/examples/pylab_examples/line_collection2.py b/examples/pylab_examples/line_collection2.py
index 03ef6ea..1bd3970 100644
--- a/examples/pylab_examples/line_collection2.py
+++ b/examples/pylab_examples/line_collection2.py
@@ -21,7 +21,7 @@ ax.set_ylim((amin(amin(ys)),amax(amax(ys))))
 #          where onoffseq is an even length tuple of on and off ink in points.
 #          If linestyle is omitted, 'solid' is used
 # See matplotlib.collections.LineCollection for more information
-line_segments = LineCollection([zip(x,y) for y in ys], # Make a sequence of x,y pairs
+line_segments = LineCollection([list(zip(x,y)) for y in ys], # Make a sequence of x,y pairs
                                 linewidths    = (0.5,1,1.5,2),
                                 linestyles = 'solid')
 line_segments.set_array(x)
diff --git a/examples/pylab_examples/mri_demo.py b/examples/pylab_examples/mri_demo.py
index d919980..66801f0 100644
--- a/examples/pylab_examples/mri_demo.py
+++ b/examples/pylab_examples/mri_demo.py
@@ -3,8 +3,8 @@ from pylab import *
 import matplotlib.cbook as cbook
 # data are 256x256 16 bit integers
 dfile = cbook.get_sample_data('s1045.ima', asfileobj=False)
-print 'loading image', dfile
-im = np.fromstring(file(dfile, 'rb').read(), np.uint16).astype(float)
+print ('loading image %s' % dfile)
+im = np.fromstring(open(dfile, 'rb').read(), np.uint16).astype(float)
 im.shape = 256, 256
 
 #imshow(im, ColormapJet(256))
diff --git a/examples/pylab_examples/mri_with_eeg.py b/examples/pylab_examples/mri_with_eeg.py
index 58d08f3..b24a7f0 100644
--- a/examples/pylab_examples/mri_with_eeg.py
+++ b/examples/pylab_examples/mri_with_eeg.py
@@ -15,8 +15,8 @@ import matplotlib.cbook as cbook
 if 1:   # load the data
     # data are 256x256 16 bit integers
     dfile = cbook.get_sample_data('s1045.ima', asfileobj=False)
-    print 'loading image', dfile
-    im = np.fromstring(file(dfile, 'rb').read(), np.uint16).astype(float)
+    print ('loading image %s' % dfile)
+    im = np.fromstring(open(dfile, 'rb').read(), np.uint16).astype(float)
     im.shape = 256, 256
 
 if 1: # plot the MRI in pcolor
@@ -40,8 +40,8 @@ if 1:   # plot the EEG
 
     numSamples, numRows = 800,4
     eegfile = cbook.get_sample_data('eeg.dat', asfileobj=False)
-    print 'loading eeg', eegfile
-    data = np.fromstring(file(eegfile, 'rb').read(), float)
+    print ('loading eeg %s' % eegfile)
+    data = np.fromstring(open(eegfile, 'rb').read(), float)
     data.shape = numSamples, numRows
     t = 10.0 * np.arange(numSamples, dtype=float)/numSamples
     ticklocs = []
diff --git a/examples/pylab_examples/scatter_custom_symbol.py b/examples/pylab_examples/scatter_custom_symbol.py
index 8a845e2..602e2a9 100644
--- a/examples/pylab_examples/scatter_custom_symbol.py
+++ b/examples/pylab_examples/scatter_custom_symbol.py
@@ -6,7 +6,7 @@ from numpy.random import rand
 rx, ry = 3., 1.
 area = rx * ry * pi
 theta = arange(0, 2*pi+0.01, 0.1)
-verts = zip(rx/area*cos(theta), ry/area*sin(theta))
+verts = list(zip(rx/area*cos(theta), ry/area*sin(theta)))
 
 x,y,s,c = rand(4, 30)
 s*= 10**2.
diff --git a/examples/pylab_examples/scatter_profile.py b/examples/pylab_examples/scatter_profile.py
index 2e45a7f..dba0a03 100644
--- a/examples/pylab_examples/scatter_profile.py
+++ b/examples/pylab_examples/scatter_profile.py
@@ -8,15 +8,15 @@ N       Classic     Base renderer    Ext renderer
 10000    3.30           1.31            0.53
 50000    19.30          6.53            1.98
 """
-from pylab import *
+import pylab
 
 import time
 
 
 for N in (20,100,1000,10000,50000):
     tstart = time.time()
-    x = 0.9*rand(N)
-    y = 0.9*rand(N)
-    s = 20*rand(N)
-    scatter(x,y,s)
-    print '%d symbols in %1.2f s' % (N, time.time()-tstart)
+    x = 0.9*pylab.rand(N)
+    y = 0.9*pylab.rand(N)
+    s = 20*pylab.rand(N)
+    pylab.scatter(x,y,s)
+    print ('%d symbols in %1.2f s' % (N, time.time()-tstart))
diff --git a/examples/pylab_examples/scatter_star_poly.py b/examples/pylab_examples/scatter_star_poly.py
index ccad6e1..10b48ee 100644
--- a/examples/pylab_examples/scatter_star_poly.py
+++ b/examples/pylab_examples/scatter_star_poly.py
@@ -9,7 +9,7 @@ pylab.scatter(x,y,s=80,marker=">")
 pylab.subplot(322)
 pylab.scatter(x,y,s=80,marker=(5,0))
 
-verts = zip([-1.,1.,1.,-1.],[-1.,-1.,1.,-1.])
+verts = list(zip([-1.,1.,1.,-1.],[-1.,-1.,1.,-1.]))
 pylab.subplot(323)
 pylab.scatter(x,y,s=80,marker=(verts,0))
 # equivalent:
diff --git a/examples/pylab_examples/set_and_get.py b/examples/pylab_examples/set_and_get.py
index ce1dead..1aa819b 100644
--- a/examples/pylab_examples/set_and_get.py
+++ b/examples/pylab_examples/set_and_get.py
@@ -77,20 +77,20 @@ setp(l1, linewidth=2, color='r')  # line1 is thick and red
 setp(l2, linewidth=1, color='g')  # line2 is thicker and green
 
 
-print 'Line setters'
+print ('Line setters')
 setp(l1)
-print 'Line getters'
+print ('Line getters')
 getp(l1)
 
-print 'Rectangle setters'
+print ('Rectangle setters')
 setp(gca().patch)
-print 'Rectangle getters'
+print ('Rectangle getters')
 getp(gca().patch)
 
 t = title('Hi mom')
-print 'Text setters'
+print ('Text setters')
 setp(t)
-print 'Text getters'
+print ('Text getters')
 getp(t)
 
 show()
diff --git a/examples/pylab_examples/spine_placement_demo.py b/examples/pylab_examples/spine_placement_demo.py
index ffe0632..2e80f68 100644
--- a/examples/pylab_examples/spine_placement_demo.py
+++ b/examples/pylab_examples/spine_placement_demo.py
@@ -1,3 +1,4 @@
+import sys
 import matplotlib.pyplot as plt
 import numpy as np
 from matplotlib.pyplot import show
@@ -8,7 +9,7 @@ y = 2*np.sin(x)
 ax = fig.add_subplot(1,2,1)
 ax.set_title('dropped spines')
 ax.plot(x,y)
-for loc, spine in ax.spines.iteritems():
+for loc, spine in ax.spines.items():
     if loc in ['left','bottom']:
         spine.set_position(('outward',10)) # outward by 10 points
     elif loc in ['right','top']:
@@ -80,7 +81,7 @@ ax.yaxis.set_ticks_position('left')
 # ----------------------------------------------------
 
 def adjust_spines(ax,spines):
-    for loc, spine in ax.spines.iteritems():
+    for loc, spine in ax.spines.items():
         if loc in spines:
             spine.set_position(('outward',10)) # outward by 10 points
             spine.set_smart_bounds(True)
@@ -141,7 +142,10 @@ adjust_spines(ax,['left','bottom'])
 #   x
 ax.set_xlim((0,2*np.pi))
 ax.set_xticks([0,np.pi,2*np.pi])
-pichr = unichr(0x03C0)
+if sys.version_info[0] < 3:
+    pichr = unichr(0x03C0)
+else:
+    pichr = chr(0x03C0)
 ax.set_xticklabels(['0',pichr,'2 '+pichr])
 
 #   y
diff --git a/examples/pylab_examples/stix_fonts_demo.py b/examples/pylab_examples/stix_fonts_demo.py
index 356cd65..165376f 100755
--- a/examples/pylab_examples/stix_fonts_demo.py
+++ b/examples/pylab_examples/stix_fonts_demo.py
@@ -17,7 +17,7 @@ stests = [
 
 if sys.maxunicode > 0xffff:
     stests.append(
-        ur'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
+        r'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
     )
 
 from pylab import *
diff --git a/examples/pylab_examples/table_demo.py b/examples/pylab_examples/table_demo.py
index 5cf1ab6..a4495fb 100644
--- a/examples/pylab_examples/table_demo.py
+++ b/examples/pylab_examples/table_demo.py
@@ -71,7 +71,7 @@ ind = arange(len(colLabels)) + 0.3  # the x locations for the groups
 cellText = []
 width = 0.4     # the width of the bars
 yoff = array([0.0] * len(colLabels)) # the bottom values for stacked bar chart
-for row in xrange(rows):
+for row in range(rows):
     bar(ind, data[row], width, bottom=yoff, color=colours[row])
     yoff = yoff + data[row]
     cellText.append(['%1.1f' % (x/1000.0) for x in yoff])
diff --git a/examples/pylab_examples/tex_unicode_demo.py b/examples/pylab_examples/tex_unicode_demo.py
index 09ac25a..f9cf6d1 100644
--- a/examples/pylab_examples/tex_unicode_demo.py
+++ b/examples/pylab_examples/tex_unicode_demo.py
@@ -4,12 +4,12 @@
 This demo is tex_demo.py modified to have unicode. See that file for
 more information.
 """
-from matplotlib import rcParams
-rcParams['text.usetex']=True
-rcParams['text.latex.unicode']=True
+import matplotlib as mpl
+mpl.rcParams['text.usetex']=True
+mpl.rcParams['text.latex.unicode']=True
 from numpy import arange, cos, pi
-from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
-     grid, savefig, show
+from matplotlib.pyplot import (figure, axes, plot, xlabel, ylabel, title, 
+     grid, savefig, show)
 
 figure(1, figsize=(6,4))
 ax = axes([0.1, 0.1, 0.8, 0.7])
@@ -18,7 +18,7 @@ s = cos(2*2*pi*t)+2
 plot(t, s)
 
 xlabel(r'\textbf{time (s)}')
-ylabel(ur'\textit{Velocity (\u00B0/sec)}', fontsize=16)
+ylabel(r'\textit{Velocity (\u00B0/sec)}', fontsize=16)
 title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
       fontsize=16, color='r')
 grid(True)
diff --git a/examples/pylab_examples/to_numeric.py b/examples/pylab_examples/to_numeric.py
index c58a2d4..5db1e7c 100644
--- a/examples/pylab_examples/to_numeric.py
+++ b/examples/pylab_examples/to_numeric.py
@@ -5,16 +5,17 @@ convert it to an array and pass the string it to PIL for
 rendering
 """
 
-from pylab import *
+import pylab
 from matplotlib.backends.backend_agg import FigureCanvasAgg
+
 try:
     from PIL import Image
-except ImportError, exc:
+except ImportError:
     raise SystemExit("PIL must be installed to run this example")
 
-plot([1,2,3])
+pylab.plot([1,2,3])
 
-canvas = get_current_fig_manager().canvas
+canvas = pylab.get_current_fig_manager().canvas
 
 agg = canvas.switch_backends(FigureCanvasAgg)
 agg.draw()
@@ -25,9 +26,9 @@ l,b,w,h = agg.figure.bbox.bounds
 w, h = int(w), int(h)
 
 
-X = fromstring(s, uint8)
+X = pylab.fromstring(s, pylab.uint8)
 X.shape = h, w, 3
 
 im = Image.fromstring( "RGB", (w,h), s)
-# im.show()
+im.show()
 
diff --git a/examples/pylab_examples/tricontour_vs_griddata.py b/examples/pylab_examples/tricontour_vs_griddata.py
index fa1f596..ae03c0c 100644
--- a/examples/pylab_examples/tricontour_vs_griddata.py
+++ b/examples/pylab_examples/tricontour_vs_griddata.py
@@ -29,7 +29,7 @@ plt.plot(x, y, 'ko', ms=3)
 plt.xlim(-2,2)
 plt.ylim(-2,2)
 plt.title('griddata and contour (%d points, %d grid points)' % (npts, ngridx*ngridy))
-print 'griddata and contour seconds:', time.clock() - start
+print ('griddata and contour seconds: %f' % (time.clock() - start))
 
 # tricontour.
 start = time.clock()
@@ -42,6 +42,6 @@ plt.plot(x, y, 'ko', ms=3)
 plt.xlim(-2,2)
 plt.ylim(-2,2)
 plt.title('tricontour (%d points)' % npts)
-print 'tricontour seconds:', time.clock() - start
+print ('tricontour seconds: %f' % (time.clock() - start))
 
 plt.show()
diff --git a/examples/pylab_examples/unicode_demo.py b/examples/pylab_examples/unicode_demo.py
index e052c2a..795a7e3 100644
--- a/examples/pylab_examples/unicode_demo.py
+++ b/examples/pylab_examples/unicode_demo.py
@@ -1,12 +1,15 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 
-from pylab import *
-plot([1,2,4])
-title(u'Développés et fabriqués')
-xlabel(u"réactivité nous permettent d'être sélectionnés et adoptés")
-ylabel(u'André was here!')
-text( 0.5, 2.5, u'Institut für Festkörperphysik', rotation=45)
-text( 1, 1.5, u'AVA (check kerning)')
+import pylab
 
-show()
+pylab.plot([1, 2, 4])
+pylab.title(b"D\xc3\xa9velopp\xc3\xa9s et fabriqu\xc3\xa9s".decode("utf8"))
+pylab.xlabel(b"r\xc3\xa9activit\xc3\xa9 nous permettent d'\xc3\xaatre "
+             b"s\xc3\xa9lectionn\xc3\xa9s et adopt\xc3\xa9s".decode("utf8"))
+pylab.ylabel(b"Andr\xc3\xa9 was here!".decode("utf8"))
+pylab.text(0.5, 2.5, b"Institut f\xc3\xbcr Festk\xc3\xb6rperphysik".decode(
+                                                         "utf8"), rotation=45)
+pylab.text( 1, 1.5, "AVA (check kerning)")
+
+pylab.show()
diff --git a/examples/pylab_examples/usetex_baseline_test.py b/examples/pylab_examples/usetex_baseline_test.py
index 21f19cf..45273d9 100644
--- a/examples/pylab_examples/usetex_baseline_test.py
+++ b/examples/pylab_examples/usetex_baseline_test.py
@@ -3,6 +3,10 @@ import matplotlib
 import matplotlib.pyplot as plt
 import matplotlib.axes as maxes
 
+from matplotlib import rcParams
+rcParams['text.usetex']=True
+rcParams['text.latex.unicode']=True
+
 class Axes(maxes.Axes):
     """
     A hackish way to simultaneously draw texts w/ usetex=True and
diff --git a/examples/tests/backend_driver.py b/examples/tests/backend_driver.py
index 2867d18..f590e98 100644
--- a/examples/tests/backend_driver.py
+++ b/examples/tests/backend_driver.py
@@ -285,7 +285,7 @@ def report_missing(dir, flist):
     missing = list(pyfiles-flist-exclude)
     missing.sort()
     if missing:
-        print '%s files not tested: %s'%(dir, ', '.join(missing))
+        print ('%s files not tested: %s'%(dir, ', '.join(missing)))
 
 def report_all_missing(directories):
     for f in directories:
@@ -323,7 +323,7 @@ def drive(backend, directories, python=['python'], switches = []):
     if os.path.exists(path):
         import glob
         for fname in os.listdir(path):
-            os.unlink(os.path.join(path,fname))
+            os.unlink(os.path.join(path, fname))
     else:
         os.mkdir(backend)
     failures = []
@@ -338,15 +338,15 @@ def drive(backend, directories, python=['python'], switches = []):
         fpath, fname = os.path.split(fullpath)
 
         if fname in exclude:
-            print '\tSkipping %s, known to fail on backend: %s'%backend
+            print ('\tSkipping %s, known to fail on backend: %s'%backend)
             continue
 
         basename, ext = os.path.splitext(fname)
-        outfile = os.path.join(path,basename)
+        outfile = os.path.join(path, basename)
         tmpfile_name = '_tmp_%s.py' % basename
-        tmpfile = file(tmpfile_name, 'w')
+        tmpfile = open(tmpfile_name, 'w')
 
-        for line in file(fullpath):
+        for line in open(fullpath):
             line_lstrip = line.lstrip()
             if line_lstrip.startswith("#"):
                 tmpfile.write(line)
@@ -356,14 +356,14 @@ def drive(backend, directories, python=['python'], switches = []):
         tmpfile.writelines((
             'from __future__ import division\n',
             'import sys\n',
-            'sys.path.append("%s")\n'%fpath,
+            'sys.path.append("%s")\n' % fpath.replace('\\', '\\\\'),
             'import matplotlib\n',
             'matplotlib.use("%s")\n' % backend,
             'from pylab import savefig\n',
             'import numpy\n',
             'numpy.seterr(invalid="ignore")\n',
             ))
-        for line in file(fullpath):
+        for line in open(fullpath):
             line_lstrip = line.lstrip()
             if (line_lstrip.startswith('from __future__ import division') or
                 line_lstrip.startswith('matplotlib.use') or
@@ -381,7 +381,7 @@ def drive(backend, directories, python=['python'], switches = []):
         program = [x % {'name': basename} for x in python]
         ret = run(program + [tmpfile_name] + switches)
         end_time = time.time()
-        print (end_time - start_time), ret
+        print ("%s %s" % ((end_time - start_time), ret))
         #os.system('%s %s %s' % (python, tmpfile_name, ' '.join(switches)))
         os.remove(tmpfile_name)
         if ret:
@@ -430,7 +430,7 @@ def parse_options():
     if 'pylab_examples' in result.dirs:
         result.dirs[result.dirs.index('pylab_examples')] = 'pylab'
     #print result
-    return result
+    return (result)
 
 if __name__ == '__main__':
     times = {}
@@ -443,14 +443,14 @@ if __name__ == '__main__':
         for d in localdirs:
             if d.lower() not in all_backends_set:
                 continue
-            print 'removing %s'%d
+            print ('removing %s'%d)
             for fname in glob.glob(os.path.join(d, '*')):
                 os.remove(fname)
             os.rmdir(d)
         for fname in glob.glob('_tmp*.py'):
             os.remove(fname)
 
-        print 'all clean...'
+        print ('all clean...')
         raise SystemExit
     if options.coverage:
         python = ['coverage.py', '-x']
@@ -464,7 +464,7 @@ if __name__ == '__main__':
 
     report_all_missing(options.dirs)
     for backend in options.backends:
-        print 'testing %s %s' % (backend, ' '.join(options.switches))
+        print ('testing %s %s' % (backend, ' '.join(options.switches)))
         t0 = time.time()
         failures[backend] = \
             drive(backend, options.dirs, python, options.switches)
@@ -473,10 +473,10 @@ if __name__ == '__main__':
 
     # print times
     for backend, elapsed in times.items():
-        print 'Backend %s took %1.2f minutes to complete' % (backend, elapsed)
+        print ('Backend %s took %1.2f minutes to complete' % (backend, elapsed))
         failed = failures[backend]
         if failed:
-            print '  Failures: ', failed
+            print ('  Failures: %s' % failed)
         if 'template' in times:
-            print '\ttemplate ratio %1.3f, template residual %1.3f' % (
-                elapsed/times['template'], elapsed-times['template'])
+            print ('\ttemplate ratio %1.3f, template residual %1.3f' % (
+                elapsed/times['template'], elapsed-times['template']))
diff --git a/examples/units/artist_tests.py b/examples/units/artist_tests.py
index cc5d757..e3136f5 100644
--- a/examples/units/artist_tests.py
+++ b/examples/units/artist_tests.py
@@ -26,7 +26,7 @@ ax.yaxis.set_units(cm)
 verts = []
 for i in range(10):
     # a random line segment in inches
-    verts.append(zip(*inch*10*np.random.rand(2, random.randint(2,15))))
+    verts.append(list(zip(*inch*10*np.random.rand(2, random.randint(2,15)))))
 lc = collections.LineCollection(verts, axes=ax)
 ax.add_collection(lc)
 
diff --git a/examples/user_interfaces/embedding_in_tk.py b/examples/user_interfaces/embedding_in_tk.py
index f508303..c083d79 100644
--- a/examples/user_interfaces/embedding_in_tk.py
+++ b/examples/user_interfaces/embedding_in_tk.py
@@ -6,8 +6,12 @@ from numpy import arange, sin, pi
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
 from matplotlib.figure import Figure
 
-import Tkinter as Tk
 import sys
+if sys.version_info[0] < 3:
+    import Tkinter as Tk
+else:
+    import tkinter as Tk
+
 
 def destroy(e): sys.exit()
 
diff --git a/examples/user_interfaces/embedding_in_tk2.py b/examples/user_interfaces/embedding_in_tk2.py
index 37366ce..9e2a524 100644
--- a/examples/user_interfaces/embedding_in_tk2.py
+++ b/examples/user_interfaces/embedding_in_tk2.py
@@ -6,8 +6,11 @@ from numpy import arange, sin, pi
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
 from matplotlib.figure import Figure
 
-import Tkinter as Tk
 import sys
+if sys.version_info[0] < 3:
+    import Tkinter as Tk
+else:
+    import tkinter as Tk
 
 def destroy(e): sys.exit()
 
diff --git a/examples/widgets/menu.py b/examples/widgets/menu.py
index ab29c40..68a8573 100644
--- a/examples/widgets/menu.py
+++ b/examples/widgets/menu.py
@@ -75,7 +75,7 @@ class MenuItem(artist.Artist):
             self.on_select(self)
 
     def set_extent(self, x, y, w, h):
-        print x, y, w, h
+        print(x, y, w, h)
         self.rect.set_x(x)
         self.rect.set_y(y)
         self.rect.set_width(w)
@@ -171,7 +171,7 @@ hoverprops = ItemProperties(labelcolor='white', bgcolor='blue',
 menuitems = []
 for label in ('open', 'close', 'save', 'save as', 'quit'):
     def on_select(item):
-        print 'you selected', item.labelstr
+        print('you selected %s' % item.labelstr)
     item = MenuItem(fig, label, props=props, hoverprops=hoverprops,
                     on_select=on_select)
     menuitems.append(item)
diff --git a/examples/widgets/rectangle_selector.py b/examples/widgets/rectangle_selector.py
index e5553f4..35a8dda 100644
--- a/examples/widgets/rectangle_selector.py
+++ b/examples/widgets/rectangle_selector.py
@@ -15,16 +15,16 @@ def line_select_callback(eclick, erelease):
     'eclick and erelease are the press and release events'
     x1, y1 = eclick.xdata, eclick.ydata
     x2, y2 = erelease.xdata, erelease.ydata
-    print "(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2)
-    print " The button you used were: ", eclick.button, erelease.button
+    print ("(%3.2f, %3.2f) --> (%3.2f, %3.2f)" % (x1, y1, x2, y2))
+    print (" The button you used were: %s %s" % (eclick.button, erelease.button))
 
 def toggle_selector(event):
-    print ' Key pressed.'
+    print (' Key pressed.')
     if event.key in ['Q', 'q'] and toggle_selector.RS.active:
-        print ' RectangleSelector deactivated.'
+        print (' RectangleSelector deactivated.')
         toggle_selector.RS.set_active(False)
     if event.key in ['A', 'a'] and not toggle_selector.RS.active:
-        print ' RectangleSelector activated.'
+        print (' RectangleSelector activated.')
         toggle_selector.RS.set_active(True)
 
 
@@ -36,7 +36,7 @@ plt.plot(x, +np.sin(.2*np.pi*x), lw=3.5, c='b', alpha=.7)  # plot something
 plt.plot(x, +np.cos(.2*np.pi*x), lw=3.5, c='r', alpha=.5)
 plt.plot(x, -np.sin(.2*np.pi*x), lw=3.5, c='g', alpha=.3)
 
-print "\n      click  -->  release"
+print ("\n      click  -->  release")
 
 # drawtype is 'box' or 'line' or 'none'
 toggle_selector.RS = RectangleSelector(current_ax, line_select_callback,
