Shapefile缩放以在geopandas中绘制

3

我有一个意大利的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})

enter image description here

enter image description here

1个回答

5

根据您提供的第一张图片,可以通过指定适当的 x 和 y 范围来获取放大的绘图。

...
ax.set_ylim([40.4, 47.2])
ax.set_xlim([7.0, 14.4])

(将此代码放置在plt.legend()之前。)

希望这对您有用。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接