Skip to content

Instantly share code, notes, and snippets.

@martinfleis
Created October 12, 2019 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save martinfleis/62d48a607d1cf4dc7d67841b3f3e8792 to your computer and use it in GitHub Desktop.
Save martinfleis/62d48a607d1cf4dc7d67841b3f3e8792 to your computer and use it in GitHub Desktop.
Support for missing data in Geopandas plotting
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shuai-zhou
Copy link

Hi, this is helpful. But when I was trying to run the cell gdf.plot(column='pop_est', figsize=(15, 10), legend=True, missing_kwds={'color': 'lightgrey'}), I got an error message saying that AttributeError: 'PatchCollection' object has no property 'missing_kwds'. Could you please help me figure out why does this happen, Thanks.

p.s. I tried this in geopandas version 0.4.1 and geopandas version 0.6.2, both have the same issue.

@martinfleis
Copy link
Author

martinfleis commented Dec 24, 2019

Hi @Iorent, this functionality is only in development version of geopandas and will be released in version 0.7.0. If you install it directly from master branch it’ll work as illustrated here.

@shuai-zhou
Copy link

@ martinfleis. Thanks. May I ask when will the v0.7.0 be released?

@martinfleis
Copy link
Author

That has not been decided yet. It can be couple of weeks or couple of months. You can install development version now using pip install git+git://github.com/geopandas/geopandas.git to use this functionality.

@caminhathiago
Copy link

Hello, @martinfleis! Thanks for the tutorial.

However, I cannot update the geopandas from v0.6.1 to v0.7.0, and therefore I'm having the same trouble as @shuai-zhou with the 'missing_kwds' property.
How can I "install it directly from master branch" as you mentioned? Sorry, I'm new at programming and I don't even know what that means hahahah

Thank you in advance!

@martinfleis
Copy link
Author

@caminhathiago don't see it as a tutorial, it was meant to illustrate the new functionality during its development.

You need GeoPandas 0.7 to use it, so if you can't update this will not work. Installing from master is this: pip install git+git://github.com/geopandas/geopandas.git, but I would not recommend using dev version since this is already part of stable one. Why you can't update?

@caminhathiago
Copy link

caminhathiago commented Mar 26, 2020

@martinfleis Oh, I see!
I tryed reinstalling by conda, conda-forge and also updating by the same means (I use Anaconda). So, as I don't know much about packages handling, by using pip, I'm afraid to get things out of order (as once happened). Would you still recommend the pip method in this case?

@martinfleis
Copy link
Author

@caminhathiago ordered according to preference, you can try following to update:

  1. update from conda-forge: conda install -c conda-forge geopandas=0.7.0
    You may need to add conda-forge channel first (conda config --env --add channels conda-forge)

  2. update using pip from PyPI: pip install geopandas -U

  3. install dev version from GitHub: pip install git+git://github.com/geopandas/geopandas.git

@caminhathiago
Copy link

@martinifleis Thanks a lot, that was really helpfull.
In case you want to know, the first method (with conda forge) did not work, but the seccond one worked just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment