Shade states of a country according to dictionary values with Basemap

試著忘記壹切 提交于 2019-12-06 05:49:41

You copied too directly from my previous answer :)

This should work if you replace if state["State_name"] with if state["NAME_1"], as the key for names in the shapefile is NAME_1 - however there will be a different problem, as apparently your mexican_states_people dict uses a different naming convention than the shapefile, in your dict the state is abbreviated as "AGS", while in the shapefile it is called "Aguascalientes".

If there are not too many states, you could change your dict by hand, otherwise you will have to find some other mapping between abbreviations and names.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!