【问题标题】:Shapefile zooming to plot with geopandasShapefile 缩放以使用 geopandas 进行绘图
【发布时间】:2019-08-12 11:39:12
【问题描述】:

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

【问题讨论】:

    标签: pandas plot shapefile geopandas


    【解决方案1】:

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

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

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

    希望这是有用的。

    【讨论】:

      猜你喜欢
      • 2021-09-26
      • 1970-01-01
      • 2019-12-22
      • 2018-10-26
      • 1970-01-01
      • 2021-05-22
      • 2021-08-19
      • 2021-08-19
      • 2021-06-22
      相关资源
      最近更新 更多