Shapefile 缩放以使用 geopandas 绘图

Joh*_*ith 3 plot shapefile pandas geopandas

我有一个意大利的 shapefile,我正在其上绘制 GIS 数据。问题是我有一辆公共汽车在城市(罗马)内行驶的小轨迹,当我绘制时,它看起来像 1 个点。我猜是因为我的地图。

如何缩放地图(.shp)?

street_map = gpd.read_file("roads.shp")
...
...
fig,ax = plt.subplots(figsize = (20,15))
street_map.plot(ax = ax, alpha = 0.4, color = "grey")
geo_df[geo_df['Perc_'] > 25].plot(ax = ax, markersize = 20, color = "blue", 
marker = "o", label = "Neg")
geo_df[geo_df['Perc_'] < 25].plot(ax = ax, markersize = 20, color = "red", 
marker = "^", label = "Pos")
plt.legend(prop={'size':15})
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

在此输入图像描述

swa*_*hai 5

根据您的第一张图像,可以通过指定适当的 x 和 y 限制来获取放大图。

...
ax.set_ylim([40.4, 47.2])
ax.set_xlim([7.0, 14.4])
Run Code Online (Sandbox Code Playgroud)

(将此代码放在plt.legend().

希望这有用。