owid-grapher
owid-grapher copied to clipboard
Improve automatic bracketing in maps to be usable
Description
Improve the automatically generated map brackets to have a meaningful, usable option that don't involve manual processing every time. This is especially critical in large explorers (indicator-based or csv-based) or when we need to generate multiple charts for a Grapher ID-based explorer.
Expected behaviour
The system should not generate very specific brackets (see pictures below), but rounded, sensible options in the range of the full data (all the years) and following our map bracket guidelines.
Screenshots
For the indicator share in extreme poverty, this is the default behaviour:
Equal-interval strategy
Quantiles strategy
Ckmeans strategy
We would like in this example that the brackets suggested would be something closer to
Additional context
- Issue reported by Max in 2022 and by Pablo R on May 2024.
- Fiona referenced how ArcGIS creates map brackets.
- Ed mentions the squash package in R, which creates bins.