修改散佈圖
在前一個練習中,我們建立了一個散佈圖來顯示 Freddy Frequentist 的手機資料。
在這個練習中,我們做了一點魔法,讓圖會疊在小鎮地圖上。如果像之前一樣直接把資料畫上去,你會看不到地圖,也不容易找出點最密集的區域。我們可以透過調整散佈圖的顏色、標記與透明度來改善。
和之前一樣,matplotlib.pyplot 模組已以別名 plt 匯入,手機資料在 DataFrame cellphone 裡。
本練習屬於課程
Python 的資料科學入門
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Change the marker color to red
plt.scatter(cellphone.x, cellphone.y,
____=____)
# Add labels
plt.ylabel('Latitude')
plt.xlabel('Longitude')
# Display the plot
plt.show()