Quantiles choropleth
In this exercise we will create a quantile version of the tree density map. Remember that the quantile algorithm will rank and split the values into groups with the same number of elements to assign a color to each.
This time, we will create seven groups that allocate the colors of the YlGn colormap across the entire set of values.
The district_trees GeoDataFrame is again already loaded. It includes the variable n_trees_per_area, measuring tree density by district (note the variable has been multiplied by 10,000).
Este exercício faz parte do curso
Working with Geospatial Data in Python
Instruções do exercício
- Generate a choropleth using the
'n_trees_per_area'variable, a quantile classification scheme with 7 classes and theYlGncolor map. Assign the result to a variable namedax. - Remove the frames, ticks and tick labels from the plot for a cleaner map using the
set_axis_off()method.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Generate the choropleth and store the axis
____ = districts_trees.plot(column='n_trees_per_area', scheme='____',
k=____, cmap='____', legend=True)
# Remove frames, ticks and tick labels from the axis
____.set_axis_off()
plt.show()