LoslegenKostenlos loslegen

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).

Diese Übung ist Teil des Kurses

Working with Geospatial Data in Python

Kurs anzeigen

Anleitung zur Übung

  • Generate a choropleth using the 'n_trees_per_area' variable, a quantile classification scheme with 7 classes and the YlGn color map. Assign the result to a variable named ax.
  • Remove the frames, ticks and tick labels from the plot for a cleaner map using the set_axis_off() method.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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()
Code bearbeiten und ausführen