7

I have installed all the necessary and optional modules for geopandas (with the exception of rtree) as listed at http://geopandas.org/install.html

I am following the tutorials from this site and also from a couple of other bloggers such as https://borealperspectives.wordpress.com/2016/03/07/plotting-polygon-shapefiles-on-a-matplotlib-basemap-with-geopandas-shapely-and-descartes/

Here they simply use .plot() to produce a map. However when I follow I get

>>> world.plot()
<matplotlib.axes._subplots.AxesSubplot object at 0x0BB0F910>

No window with a map pops up. Here's the code snippet that should work.

>>> import geopandas as gpd
>>> world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
>>> world.plot()
<matplotlib.axes._subplots.AxesSubplot object at 0x0BB0F910>

List of versions:

  • Python 2.7.13 on Windows 7 Professional
  • geopandas 0.2.1
  • numpy 1.11.3
  • pandas 0.19.2
  • shapely 1.5.17
  • fiona 1.7.1
  • six 1.10.0
  • pyproj 1.9.5.1
  • geopy 1.11.0
  • psycopg2 2.6.2 (dt dec pq3 ext)
  • matplotlib 1.5.3
  • descartes 1.0.2

Any suggestions?

19

The examples provided are for executing the scripts in a Jupyter/IPython notebooks environment.

enter image description here

In a normal Python environment, you need to import matplotlib to show the image

import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.plot()
import matplotlib.pyplot as plt
plt.show()

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.