-
Notifications
You must be signed in to change notification settings - Fork 2
Description
@miparedes ---
We have hundreds of census tracts here: https://github.com/seattleflu/augur-build/blob/master/config/lat_longs.tsv#L49. I'd like a coloring that places nearby census tracts with similar colors, the way that we do things for, say, Zika: https://nextstrain.org/zika. For Zika, I did this color scale by hand. This is obviously impossible for the hundreds of census tracts. Instead, we'd like to automate this. My suggested algorithm:
- Load a mapping of census tract to lat/long
- Perform PCA on these lat/long values to orient the majority of variation to PC1 with PC2 orthologonal
- Use PC1 to pick colors along the official Nextstrain ramp: https://github.com/nextstrain/auspice/blob/master/src/util/globals.js#L128
- If you rank order PC1 you can slot the first X census tracts to
#511EA8, the second X census tracts to#4928B4, etc... where X is chosen to equally distribute census tracts along the 36 elements of the color ramp.
This should end up as a Python script that takes a lat_longs.tsv and also a label (like region, country or location) and produces a colors.tsv output.
No hurry on this. I've wanted a script like this for a while as it would be generally useful in Nextstrain. And I think it could be a good programming challenge.