Urban Residents 邻里区域的中心点
现在请找到 urban_poly_3857 的中心点,并将其绘制在该多边形之上。
本练习是课程的一部分
在 Python 中可视化地理空间数据
练习说明
- 使用 GeoSeries 的
centroid属性,从urban_poly_3857创建downtown_center。 - 打印
downtown_center的数据类型。 - 将
urban_poly_3857绘制为 ax,颜色使用lightgreen。 - 绘制
downtown_center,并设置ax = ax与color = black。x 轴刻度已为您旋转。我们已包含显示图形的代码。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Create downtown_center from urban_poly_3857
downtown_center = urban_poly_3857.____.____
# Print the type of downtown_center
print(type(downtown_center))
# Plot the urban_poly_3857 as ax and add the center point
ax = ____.plot(color = 'lightgreen')
____.plot(ax = ____, color = 'black')
plt.xticks(rotation = 45)
# Show the plot
plt.show()