pandas - Shapefile 缩放以使用 geopandas 绘图

标签 pandas plot shapefile geopandas

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

如何缩放 map (.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

最佳答案

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

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

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

希望这是有用的。

关于pandas - Shapefile 缩放以使用 geopandas 绘图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55283440/

相关文章:

python - pandas 读取顶行左列空白的 Excel 文件时出现问题

python-3.x - Pandas 分组依据和条件比率

r - 结合 3D/2D 绘图

python - 使用 basemap 和 Pandas 创建Choropleth map

python - 在Python中将对象数据类型的内容转换为日期数据类型

python - 以原点 ='end_day' 重新采样

python - matplotlib/Python 中条形图的单独标记条

r - 如何在 R 中绘制乘积函数?

java - 在java中绘制一个shapefile

javascript - 如何从.shp文件缩放/选择D3投影设置