egayer
egayer

Reputation: 41

GeoPandas plotting issues

I am struggling with arguments when plotting with GeoPandas. For some reasons that I don't understand, I get this error

TypeError: plot_dataframe() got an unexpected keyword argument 'facecolor' 

when trying to use 'facecolor', 'edgecolor', 'linewidth' and other arguments and keywords that are supposed to be passed to matplotlib (in my understanding).

Here an example of my code

import geopandas as gpd
import matplotlib.pyplot as plt

my_shape=gpd.GeoDataFrame.from_file('myshape.shp')
f = plt.figure()
my_shape.plot(column='TYPE',colormap='cubehelix', alpha=0.5, categorical=True, legend=True, axes=f.gca(), edgecolor='w')

I might be doing something wrong but even when I try to reproduce this example :

Change single patch color in geopandas

I can't get it right and still get the type error

Thanks for your help

Python 2.7.10 Anaconda 2.0.1 (x86_64), Matplotlib 1.4.3, GeoPandas 0.1.1 (pysal 1.10.0, descartes 1.0.1)

Upvotes: 0

Views: 1794

Answers (1)

joris
joris

Reputation: 139142

Other arguments and keywords like 'facecolor', 'edgecolor', 'linewidth' are not passed to matplotlib in version 0.1.1.
You can have a look in the docstring to see which arguments are supported. In version 0.1.1 only colormap and alpha are supported keywords that style the plot.

In the current development version also linewidth is supported, and some color keywords are indeed passed to matplotlib.

Upvotes: 1

Related Questions