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

Skip to content

Commit 8b9f2e7

Browse files
author
cclauss
committed
Convert six.moves.xrange() to range() for Python 3
1 parent 5f97bc1 commit 8b9f2e7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
unicode_literals)
33

44
import six
5-
from six.moves import zip, zip_longest
5+
from six.moves import xrange, zip, zip_longest
66

77
import functools
88
import itertools
@@ -3923,7 +3923,7 @@ def dopatch(xs, ys, **kwargs):
39233923
else:
39243924
def doplot(*args, **kwargs):
39253925
shuffled = []
3926-
for i in range(0, len(args), 2):
3926+
for i in xrange(0, len(args), 2):
39273927
shuffled.extend([args[i + 1], args[i]])
39283928
return self.plot(*shuffled, **kwargs)
39293929

@@ -3937,7 +3937,7 @@ def dopatch(xs, ys, **kwargs):
39373937
"values must have same the length")
39383938
# check position
39393939
if positions is None:
3940-
positions = list(range(1, N + 1))
3940+
positions = list(xrange(1, N + 1))
39413941
elif len(positions) != N:
39423942
raise ValueError(datashape_message.format("positions"))
39433943

@@ -4558,31 +4558,31 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
45584558

45594559
# create accumulation arrays
45604560
lattice1 = np.empty((nx1, ny1), dtype=object)
4561-
for i in range(nx1):
4562-
for j in range(ny1):
4561+
for i in xrange(nx1):
4562+
for j in xrange(ny1):
45634563
lattice1[i, j] = []
45644564
lattice2 = np.empty((nx2, ny2), dtype=object)
4565-
for i in range(nx2):
4566-
for j in range(ny2):
4565+
for i in xrange(nx2):
4566+
for j in xrange(ny2):
45674567
lattice2[i, j] = []
45684568

4569-
for i in range(len(x)):
4569+
for i in xrange(len(x)):
45704570
if bdist[i]:
45714571
if 0 <= ix1[i] < nx1 and 0 <= iy1[i] < ny1:
45724572
lattice1[ix1[i], iy1[i]].append(C[i])
45734573
else:
45744574
if 0 <= ix2[i] < nx2 and 0 <= iy2[i] < ny2:
45754575
lattice2[ix2[i], iy2[i]].append(C[i])
45764576

4577-
for i in range(nx1):
4578-
for j in range(ny1):
4577+
for i in xrange(nx1):
4578+
for j in xrange(ny1):
45794579
vals = lattice1[i, j]
45804580
if len(vals) > mincnt:
45814581
lattice1[i, j] = reduce_C_function(vals)
45824582
else:
45834583
lattice1[i, j] = np.nan
4584-
for i in range(nx2):
4585-
for j in range(ny2):
4584+
for i in xrange(nx2):
4585+
for j in xrange(ny2):
45864586
vals = lattice2[i, j]
45874587
if len(vals) > mincnt:
45884588
lattice2[i, j] = reduce_C_function(vals)
@@ -6480,7 +6480,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
64806480
'weights should have the same shape as x')
64816481

64826482
if color is None:
6483-
color = [self._get_lines.get_next_color() for i in range(nx)]
6483+
color = [self._get_lines.get_next_color() for i in xrange(nx)]
64846484
else:
64856485
color = mcolors.to_rgba_array(color)
64866486
if len(color) != nx:
@@ -6507,7 +6507,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
65076507
tops = []
65086508
mlast = None
65096509
# Loop through datasets
6510-
for i in range(nx):
6510+
for i in xrange(nx):
65116511
# this will automatically overwrite bins,
65126512
# so that each histogram uses the same bins
65136513
m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)

0 commit comments

Comments
 (0)