empress icon indicating copy to clipboard operation
empress copied to clipboard

Support coloring the tree by continuous feature metadata

Open fedarko opened this issue 3 years ago • 0 comments

I thought there was an open issue for this, but can't find it. Anyway, this would be useful to have: each tip (with metadata, at least) would get assigned a color based on its numeric value for a given feature metadata field, with non-numeric / missing values remaining uncolored (or colored a specific "non-numeric" color, or hidden, I guess?)

Colors could be "propagated" up the tree from the tips by doing something like averaging all child nodes' values -- this should create a pretty gradient effect and (hopefully) be a meaningful way of representing this. (Could also support e.g. taking the median of child values, and there are probably lots of different ways of representing the "gradient" coloring.)

Inspired by this section of the ggtree manual which has a lot of pretty examples of trees colored using continuous data.

A lot of this should involve code reusable from continuous barplots, so hopefully this wouldn't be too much of a pain to add.

Also, this'd pair really well with #387, since many color maps include very light colors, which are hard to draw on a white background by themselves -- being able to draw a node and then draw a rectangle behind it of a given color would make this a lot clearer, probably.

fedarko avatar Oct 01 '20 20:10 fedarko