在多邊形上繪製點座標 - 第 2 部分
我們已經將常用的函式庫載入為 pd、plt 和 gpd,將雞隻資料集載入為 chickens,服務區資料載入為 service_district。把服務區與雞隻許可資料一起繪製,看看你的視覺化能說出什麼故事。
本練習屬於課程
在 Python 視覺化地理空間資料
練習說明
- 先繪製包含服務區的 GeoDataFrame。圖例的顏色請使用
name欄位。 - 接著從雞隻資料中繪製緯度與經度來建立散佈圖。將標記顏色設為
'black',並加上'white'的外框。 - 為圖表加上標題:'Nashville Chicken Permits',並將 x 軸標記為 'longitude'、y 軸標記為 'latitude'。
- 加上格線,然後顯示你的圖表。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Plot the service district shapefile
service_district.plot(column=____, legend=True)
# Add the chicken locations
plt.scatter(x=____, y=____, c=____, edgecolor = 'white')
# Add labels and title
plt.____('Nashville Chicken Permits')
plt.xlabel(____)
plt.ylabel(____)
# Add grid lines and show the plot
plt.____()
plt.____()