Skip to content

Commit

Permalink
Compatibility with older versions of matplotlib
Browse files Browse the repository at this point in the history
  • Loading branch information
IamJeffG committed Mar 24, 2016
1 parent 12d3623 commit 5533217
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions geopandas/plotting.py
Expand Up @@ -193,6 +193,11 @@ def plot_point_collection(ax, geoms, colors_or_values,
"""
x = [p.x for p in geoms]
y = [p.y for p in geoms]

# matplotlib ax.scatter requires RGBA color specifications to be a single 2D
# array, NOT merely a list of 1D arrays. This reshapes that if necessary,
# having no effect on 1D arrays of values.
colors_or_values = np.array([element for _, element in enumerate(colors_or_values)])
collection = ax.scatter(x, y, c=colors_or_values,
vmin=vmin, vmax=vmax, cmap=cmap,
marker=marker, s=markersize, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion requirements.test.txt
@@ -1,7 +1,7 @@
psycopg2>=2.5.1
SQLAlchemy>=0.8.3
geopy==1.10.0
matplotlib>=1.5.0
matplotlib>=1.2.1
descartes>=1.0
mock>=1.0.1 # technically not need for python >= 3.3
pytest-cov
Expand Down

0 comments on commit 5533217

Please sign in to comment.