開始使用免費開始

Urban Residents 社區的中心點

現在你要找出 urban_poly_3857 的中心點,並將它疊加在該多邊形上繪製。

本練習屬於課程

在 Python 視覺化地理空間資料

檢視課程

練習說明

  • 使用 GeoSeries 的 centroid 屬性,從 urban_poly_3857 建立 downtown_center
  • 印出 downtown_center 的資料型別。
  • lightgreen 顏色將 urban_poly_3857 繪製為 ax。
  • 繪製 downtown_center,並設定 ax = axcolor = 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()
編輯並執行程式碼