開始使用免費開始

色彩映射(Colormaps)

當你想區分不同區域、但不想暗示區域之間有任何關聯時,最適合使用「定性」色彩映射。 在這個練習中,你會用 school_districts 這個 GeoDataFrame(已提供給你)比較一種定性色彩映射與一種循序(定量)色彩映射。

本練習屬於課程

在 Python 視覺化地理空間資料

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Set legend style
lgnd_kwds = {'title': 'School Districts',
               'loc': 'upper left', 'bbox_to_anchor': (1, 1.03), 'ncol': 1}

# Plot the school districts using the tab20 colormap (qualitative)
school_districts.plot(column = ____, ____ = 'tab20', ____ = True, ____ = lgnd_kwds)
plt.xlabel('Longitude')
plt.ylabel('Latitude')
plt.title('Nashville School Districts')
plt.show();
編輯並執行程式碼