Urban Residents 社區的中心點
現在你要找出 urban_poly_3857 的中心點,並將它疊加在該多邊形上繪製。
本練習屬於課程
在 Python 視覺化地理空間資料
練習說明
- 使用 GeoSeries 的
centroid屬性,從urban_poly_3857建立downtown_center。 - 印出
downtown_center的資料型別。 - 以
lightgreen顏色將urban_poly_3857繪製為 ax。 - 繪製
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()