From 08e4be9f6c62cb74979e413aeeb9fca5c416e8d9 Mon Sep 17 00:00:00 2001 From: Kelsey Jordahl Date: Wed, 16 Apr 2014 14:53:02 -0400 Subject: [PATCH] PY3: Use six imports for generator and xrange --- geopandas/plotting.py | 7 +++++-- tests/test_plotting.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/geopandas/plotting.py b/geopandas/plotting.py index 35ed274..69557de 100644 --- a/geopandas/plotting.py +++ b/geopandas/plotting.py @@ -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() diff --git a/tests/test_plotting.py b/tests/test_plotting.py index 31a0b4d..aab66b1 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -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