owid-grapher
owid-grapher copied to clipboard
Support custom ordering in scatterplot legend
Requested by @pabloarosado
Problem
The scatterplot legend is ordered alphabetically, which makes sense when it represents a nominal categorical variable (e.g. gender, region) but not when it represents an ordinal one.
In the example below, rather than alphabetical order, the legend would be better ordered from "Low income" to "High income", or the reverse, with "Not categorised" at the end.

Technical context
- Scatterplots allow you to colour by a variable
- But variables are currently untyped, meaning that Grapher does not know even if they are categorical or numeric until it looks at the data, let alone whether the data is sequential or ordinal
From discussion with @danyx23 , it would be possible to solve this in the grapher admin, but even nicer would be to try to solve the general problem in the upstream data.
Marking as "nice to have" and estimating a 3d fix, which makes it unlikely we'll come to it soon.
This issue came up again today as a request by Joe.
This issue has had no activity within 10 months. It is considered stale and will be closed in 7 days unless it is worked on or tagged as pinned.
This is one of the motivating example for getting data types into Grapher (which we really want to do), so I want to keep this issue open for now