Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

py3 fixes for axes.py

  • Loading branch information...
commit 1e081904a8881d0501025269cb4d1318769a5866 1 parent f4245bb
pwuertz authored pelson committed
Showing with 21 additions and 21 deletions.
  1. +21 −21 lib/matplotlib/axes.py
View
42 lib/matplotlib/axes.py
@@ -288,7 +288,7 @@ def _plot_args(self, tup, kwargs):
linestyle, marker, color = _process_plot_format(tup[-1])
tup = tup[:-1]
elif len(tup) == 3:
- raise ValueError, 'third arg must be a format string'
+ raise ValueError('third arg must be a format string')
else:
linestyle, marker, color = None, None, None
kw = {}
@@ -1489,7 +1489,7 @@ def _update_line_limits(self, line):
return
line_trans = line.get_transform()
-
+
if line_trans == self.transData:
data_path = path
@@ -1508,8 +1508,8 @@ def _update_line_limits(self, line):
else:
data_path = trans_to_data.transform_path(path)
else:
- # for backwards compatibility we update the dataLim with the
- # coordinate range of the given path, even though the coordinate
+ # for backwards compatibility we update the dataLim with the
+ # coordinate range of the given path, even though the coordinate
# systems are completely different. This may occur in situations
# such as when ax.transAxes is passed through for absolute
# positioning.
@@ -1519,7 +1519,7 @@ def _update_line_limits(self, line):
updatex, updatey = line_trans.contains_branch_seperately(
self.transData
)
- self.dataLim.update_from_path(data_path,
+ self.dataLim.update_from_path(data_path,
self.ignore_existing_data_limits,
updatex=updatex,
updatey=updatey)
@@ -2216,11 +2216,11 @@ def ticklabel_format(self, **kwargs):
cb = False
else:
cb = True
- raise NotImplementedError, "comma style remains to be added"
+ raise NotImplementedError("comma style remains to be added")
elif style == '':
sb = None
else:
- raise ValueError, "%s is not a valid style value"
+ raise ValueError("%s is not a valid style value")
try:
if sb is not None:
if axis == 'both' or axis == 'x':
@@ -3723,9 +3723,9 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
xmax = np.resize( xmax, y.shape )
if len(xmin)!=len(y):
- raise ValueError, 'xmin and y are unequal sized sequences'
+ raise ValueError('xmin and y are unequal sized sequences')
if len(xmax)!=len(y):
- raise ValueError, 'xmax and y are unequal sized sequences'
+ raise ValueError('xmax and y are unequal sized sequences')
verts = [ ((thisxmin, thisy), (thisxmax, thisy))
for thisxmin, thisxmax, thisy in zip(xmin, xmax, y)]
@@ -3802,9 +3802,9 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
ymax = np.resize( ymax, x.shape )
if len(ymin)!=len(x):
- raise ValueError, 'ymin and x are unequal sized sequences'
+ raise ValueError('ymin and x are unequal sized sequences')
if len(ymax)!=len(x):
- raise ValueError, 'ymax and x are unequal sized sequences'
+ raise ValueError('ymax and x are unequal sized sequences')
Y = np.array([ymin, ymax]).T
@@ -4785,7 +4785,7 @@ def make_iterable(x):
if len(height) == 1:
height *= nbars
else:
- raise ValueError, 'invalid orientation: %s' % orientation
+ raise ValueError('invalid orientation: %s' % orientation)
if len(linewidth) < nbars:
linewidth *= nbars
@@ -4843,7 +4843,7 @@ def make_iterable(x):
bottom = [bottom[i] - height[i]/2. for i in xrange(len(bottom))]
else:
- raise ValueError, 'invalid alignment: %s' % align
+ raise ValueError('invalid alignment: %s' % align)
args = zip(left, bottom, width, height, color, edgecolor, linewidth)
for l, b, w, h, c, e, lw in args:
@@ -5718,7 +5718,7 @@ def computeConfInterval(data, med, iq, bootstrap):
else:
x = [x[:,i] for i in xrange(nc)]
else:
- raise ValueError, "input x can have no more than 2 dimensions"
+ raise ValueError("input x can have no more than 2 dimensions")
if not hasattr(x[0], '__len__'):
x = [x]
col = len(x)
@@ -7086,10 +7086,10 @@ def _pcolorargs(self, funcname, *args):
Nx = X.shape[-1]
Ny = Y.shape[0]
- if len(X.shape) <> 2 or X.shape[0] == 1:
+ if len(X.shape) != 2 or X.shape[0] == 1:
x = X.reshape(1,Nx)
X = x.repeat(Ny, axis=0)
- if len(Y.shape) <> 2 or Y.shape[1] == 1:
+ if len(Y.shape) != 2 or Y.shape[1] == 1:
y = Y.reshape(Ny, 1)
Y = y.repeat(Nx, axis=1)
if X.shape != Y.shape:
@@ -8834,9 +8834,9 @@ def __init__(self, fig, *args, **kwargs):
def __reduce__(self):
# get the first axes class which does not inherit from a subplotbase
- axes_class = filter(lambda klass: (issubclass(klass, Axes) and
- not issubclass(klass, SubplotBase)),
- self.__class__.mro())[0]
+ not_subplotbase = lambda c: issubclass(c, Axes) and \
+ not issubclass(c, SubplotBase)
+ axes_class = [c for c in self.__class__.mro() if not_subplotbase(c)][0]
r = [_PicklableSubplotClassConstructor(),
(axes_class,),
self.__getstate__()]
@@ -8925,8 +8925,8 @@ def subplot_class_factory(axes_class=None):
class _PicklableSubplotClassConstructor(object):
"""
- This stub class exists to return the appropriate subplot
- class when __call__-ed with an axes class. This is purely to
+ This stub class exists to return the appropriate subplot
+ class when __call__-ed with an axes class. This is purely to
allow Pickling of Axes and Subplots.
"""
def __call__(self, axes_class):
Please sign in to comment.
Something went wrong with that request. Please try again.