我正在学习使用以下代码在Spyder IDE中使用geopandas包创建“分层”地图:
import geopandas as geopandas
import matplotlib.pyplot as plt
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
cities = geopandas.read_file(geopandas.datasets.get_path('naturalearth_cities'))
world.plot()
ax = plt.subplot(1, 1)
world.plot(column='pop_est', ax=ax, legend=True)我像在RStudio中一样逐行执行代码。不幸的是,我只能得到一张白色的白纸,而不是地图。
发布于 2020-04-29 15:46:28
我在Jupyter上运行了这个示例,但我认为只要您安装了这些包,它就不会改变任何事情。
f, ax = plt.subplots(1,1,figsize=(10,10))
world.plot(column='pop_est', ax=ax, legend=True)

如果只对几何图形感兴趣,则可以执行以下操作:
world.geometry.plot(color="white", edgecolor='k')如果将来想要将此几何添加到地图中,可以执行以下操作
world.geometry.plot(color=None, edgecolor='k')https://stackoverflow.com/questions/61489076
复制相似问题