owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.35k stars 227 forks source link

Improve automatic bracketing in maps to be usable #3640

Open paarriagadap opened 1 month ago

paarriagadap commented 1 month ago

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 share-of-population-living-in-extreme-poverty (3)

Quantiles strategy share-of-population-living-in-extreme-poverty (2)

Ckmeans strategy share-of-population-living-in-extreme-poverty (1)

We would like in this example that the brackets suggested would be something closer to share-of-population-in-extreme-poverty (10)

Additional context

marcelgerber commented 1 month ago

Additional context: This document outlines the binning strategies that ArcGIS provides (thanks Fiona!).

pabloarosado commented 1 month ago

Thanks for writing this up, @paarriagadap. Creating map brackets is a big pain!

I've created a separate issue with a proposed implementation of how to improve the current tool in the chart admin. The current issue can be about deciding the optimal strategy (which I think can be harder to figure out).

But for explorers, there's no grapher admin tool, and I think we are from having one, so I've created this separate ETL issue to have something useful with streamlit.

danyx23 commented 4 weeks ago

We talked about this today in data viz triage and yesterday in the data meeting and there is a good chance that @pabloarosado has time in his upcoming cycle to tackle this problem on the python side and come up with a good algorithm that comes close to our guilelines. Once this is done it should not be too much work to reimplement this in grapher.