Easiest way to plot data on country map with python

Viewed 17407

Could not delete question. Please refer to question: Shade states of a country according to dictionary values with Basemap

I want to plot data (number of sick people for a certain year) on each state of Mexico. I am using jupyter notebook. So far I have seen several options and tutorials, but none seem to seem to explicitly explain how to plot the map of a country. Below I explain some options/tutorial I have seen and why they have not worked (this I do just to argue that tutorials are not very straight forward):

  1. Bokeh (http://docs.bokeh.org/en/latest/docs/gallery/texas.html). In the tutorial texas state is plotted given that us_counties is in bokeh.sampledata. However I have not found other countries in the sampledata.

  2. mpl_toolkits.basemap (http://www.geophysique.be/2011/01/27/matplotlib-basemap-tutorial-07-shapefiles-unleached/). Although I am able to import shapefile, I cannot run from shapefile import ShapeFile (ImportError: cannot import name ShapeFile). Furthermore I have not been able to download dbflib library.

  3. Vincent (Why Python Vincent map visuzalization does not map data from Data Frame?) When I run the code from the answer in said tutorial no image appears (even though I used command vincent.core.initialize_notebook() ).

  4. Plotly (https://plot.ly/python/choropleth-maps/). The tutorial plots the map of USA importing information from a csv table (no information of other countries available). If wanting to plot another country, would it be possible to make the table?

Explored this 4 options I have found tutorials not to be very clear or easy to follow. I find it hard to believe that plotting a map of a country is difficult in python. I think there must be an easier way than the ones explained in the past tutorials.

The question is: Which is the easiest (hopefully simple) way to plot the map of a certain country (any) with python and how?

I have installed the following packages: matplotlib, pyshp, mpl_toolkits.basemap, bokeh, pandas, numpy. I have also downloaded Mexico's map from http://www.gadm.org/

Thanks in advance.

2 Answers
Related