Districts coloured by total and by rides per dock
Ardenvale has no population data, so the rate is rides per dock. A map that shows a count and a map that shows a rate are two different answers.
A choropleth colours each area by a value, and a symbol map puts a circle on each place. Both are easy to draw and easy to get wrong: totals follow size, classes decide the colours, a circle's area (not its radius) must show the value, and zoom must not grow the symbols.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 4 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Add a legend to the choropleth: four squares with the class ranges (scale.thresholds() gives the breaks of a quantize scale).
Write circleRadius(value, max, maxRadius) that returns 0 for missing, zero or negative values, and a square-root scaled radius otherwise.
Explain it without notes
Why is a choropleth of total rides less useful than one of rides per dock?
How do quantize, quantile and threshold scales differ, and when does each mislead?
Why must a circle's radius be the square root of the value?
How do you stop circles growing when the map zooms?
Preview
Console
Nothing logged yet.Expected console output
district | rides | docks | per dock | class by total | class per dock
Harbour | 247823 | 84 | 2950 | 4 | 4
Old Town | 237979 | 106 | 2245 | 4 | 3
University | 149867 | 88 | 1703 | 3 | 2
Riverside | 135790 | 78 | 1741 | 2 | 2
Hillcrest | 116649 | 76 | 1535 | 2 | 2
Westpark | 45543 | 52 | 876 | 1 | 1
Busiest district against the quietest: total 5.4x, per dock 3.4x
all six equal: every district is class 4 | a missing value: no data | NaN: no data
quantile classes (about equal counts): 4 4 2 3 1 1 | quantize classes: 4 3 2 2 2 1