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

Skip to content

Commit 1e08190

Browse files
pwuertzpelson
authored andcommitted
py3 fixes for axes.py
1 parent f4245bb commit 1e08190

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

lib/matplotlib/axes.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def _plot_args(self, tup, kwargs):
288288
linestyle, marker, color = _process_plot_format(tup[-1])
289289
tup = tup[:-1]
290290
elif len(tup) == 3:
291-
raise ValueError, 'third arg must be a format string'
291+
raise ValueError('third arg must be a format string')
292292
else:
293293
linestyle, marker, color = None, None, None
294294
kw = {}
@@ -1489,7 +1489,7 @@ def _update_line_limits(self, line):
14891489
return
14901490

14911491
line_trans = line.get_transform()
1492-
1492+
14931493
if line_trans == self.transData:
14941494
data_path = path
14951495

@@ -1508,8 +1508,8 @@ def _update_line_limits(self, line):
15081508
else:
15091509
data_path = trans_to_data.transform_path(path)
15101510
else:
1511-
# for backwards compatibility we update the dataLim with the
1512-
# coordinate range of the given path, even though the coordinate
1511+
# for backwards compatibility we update the dataLim with the
1512+
# coordinate range of the given path, even though the coordinate
15131513
# systems are completely different. This may occur in situations
15141514
# such as when ax.transAxes is passed through for absolute
15151515
# positioning.
@@ -1519,7 +1519,7 @@ def _update_line_limits(self, line):
15191519
updatex, updatey = line_trans.contains_branch_seperately(
15201520
self.transData
15211521
)
1522-
self.dataLim.update_from_path(data_path,
1522+
self.dataLim.update_from_path(data_path,
15231523
self.ignore_existing_data_limits,
15241524
updatex=updatex,
15251525
updatey=updatey)
@@ -2216,11 +2216,11 @@ def ticklabel_format(self, **kwargs):
22162216
cb = False
22172217
else:
22182218
cb = True
2219-
raise NotImplementedError, "comma style remains to be added"
2219+
raise NotImplementedError("comma style remains to be added")
22202220
elif style == '':
22212221
sb = None
22222222
else:
2223-
raise ValueError, "%s is not a valid style value"
2223+
raise ValueError("%s is not a valid style value")
22242224
try:
22252225
if sb is not None:
22262226
if axis == 'both' or axis == 'x':
@@ -3723,9 +3723,9 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
37233723
xmax = np.resize( xmax, y.shape )
37243724

37253725
if len(xmin)!=len(y):
3726-
raise ValueError, 'xmin and y are unequal sized sequences'
3726+
raise ValueError('xmin and y are unequal sized sequences')
37273727
if len(xmax)!=len(y):
3728-
raise ValueError, 'xmax and y are unequal sized sequences'
3728+
raise ValueError('xmax and y are unequal sized sequences')
37293729

37303730
verts = [ ((thisxmin, thisy), (thisxmax, thisy))
37313731
for thisxmin, thisxmax, thisy in zip(xmin, xmax, y)]
@@ -3802,9 +3802,9 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
38023802
ymax = np.resize( ymax, x.shape )
38033803

38043804
if len(ymin)!=len(x):
3805-
raise ValueError, 'ymin and x are unequal sized sequences'
3805+
raise ValueError('ymin and x are unequal sized sequences')
38063806
if len(ymax)!=len(x):
3807-
raise ValueError, 'ymax and x are unequal sized sequences'
3807+
raise ValueError('ymax and x are unequal sized sequences')
38083808

38093809
Y = np.array([ymin, ymax]).T
38103810

@@ -4785,7 +4785,7 @@ def make_iterable(x):
47854785
if len(height) == 1:
47864786
height *= nbars
47874787
else:
4788-
raise ValueError, 'invalid orientation: %s' % orientation
4788+
raise ValueError('invalid orientation: %s' % orientation)
47894789

47904790
if len(linewidth) < nbars:
47914791
linewidth *= nbars
@@ -4843,7 +4843,7 @@ def make_iterable(x):
48434843
bottom = [bottom[i] - height[i]/2. for i in xrange(len(bottom))]
48444844

48454845
else:
4846-
raise ValueError, 'invalid alignment: %s' % align
4846+
raise ValueError('invalid alignment: %s' % align)
48474847

48484848
args = zip(left, bottom, width, height, color, edgecolor, linewidth)
48494849
for l, b, w, h, c, e, lw in args:
@@ -5718,7 +5718,7 @@ def computeConfInterval(data, med, iq, bootstrap):
57185718
else:
57195719
x = [x[:,i] for i in xrange(nc)]
57205720
else:
5721-
raise ValueError, "input x can have no more than 2 dimensions"
5721+
raise ValueError("input x can have no more than 2 dimensions")
57225722
if not hasattr(x[0], '__len__'):
57235723
x = [x]
57245724
col = len(x)
@@ -7086,10 +7086,10 @@ def _pcolorargs(self, funcname, *args):
70867086

70877087
Nx = X.shape[-1]
70887088
Ny = Y.shape[0]
7089-
if len(X.shape) <> 2 or X.shape[0] == 1:
7089+
if len(X.shape) != 2 or X.shape[0] == 1:
70907090
x = X.reshape(1,Nx)
70917091
X = x.repeat(Ny, axis=0)
7092-
if len(Y.shape) <> 2 or Y.shape[1] == 1:
7092+
if len(Y.shape) != 2 or Y.shape[1] == 1:
70937093
y = Y.reshape(Ny, 1)
70947094
Y = y.repeat(Nx, axis=1)
70957095
if X.shape != Y.shape:
@@ -8834,9 +8834,9 @@ def __init__(self, fig, *args, **kwargs):
88348834

88358835
def __reduce__(self):
88368836
# get the first axes class which does not inherit from a subplotbase
8837-
axes_class = filter(lambda klass: (issubclass(klass, Axes) and
8838-
not issubclass(klass, SubplotBase)),
8839-
self.__class__.mro())[0]
8837+
not_subplotbase = lambda c: issubclass(c, Axes) and \
8838+
not issubclass(c, SubplotBase)
8839+
axes_class = [c for c in self.__class__.mro() if not_subplotbase(c)][0]
88408840
r = [_PicklableSubplotClassConstructor(),
88418841
(axes_class,),
88428842
self.__getstate__()]
@@ -8925,8 +8925,8 @@ def subplot_class_factory(axes_class=None):
89258925

89268926
class _PicklableSubplotClassConstructor(object):
89278927
"""
8928-
This stub class exists to return the appropriate subplot
8929-
class when __call__-ed with an axes class. This is purely to
8928+
This stub class exists to return the appropriate subplot
8929+
class when __call__-ed with an axes class. This is purely to
89308930
allow Pickling of Axes and Subplots.
89318931
"""
89328932
def __call__(self, axes_class):

0 commit comments

Comments
 (0)