PY3: Use six imports for generator and xrange

This commit is contained in:
Kelsey Jordahl
2014-04-16 14:53:02 -04:00
parent a16291b353
commit 08e4be9f6c
2 changed files with 6 additions and 2 deletions
+5 -2
View File
@@ -1,5 +1,8 @@
from __future__ import print_function
import numpy as np
from six import next
from six.moves import xrange
def plot_polygon(ax, poly, facecolor='red', edgecolor='black', alpha=0.5):
@@ -107,9 +110,9 @@ def plot_series(s, colormap='Set1', alpha=0.5, axes=None):
color = gencolor(len(s), colormap=colormap)
for geom in s:
if geom.type == 'Polygon' or geom.type == 'MultiPolygon':
plot_multipolygon(ax, geom, facecolor=color.next(), alpha=alpha)
plot_multipolygon(ax, geom, facecolor=next(color), alpha=alpha)
elif geom.type == 'LineString' or geom.type == 'MultiLineString':
plot_multilinestring(ax, geom, color=color.next())
plot_multilinestring(ax, geom, color=next(color))
elif geom.type == 'Point':
plot_point(ax, geom)
plt.draw()
+1
View File
@@ -9,6 +9,7 @@ from matplotlib.pyplot import Artist, savefig, clf
from matplotlib.testing.noseclasses import ImageComparisonFailure
from matplotlib.testing.compare import compare_images
from shapely.geometry import Polygon, LineString, Point
from six.moves import xrange
from geopandas import GeoSeries