thackl / gggenomes

A grammar of graphics for comparative genomics
https://thackl.github.io/gggenomes/
Other
581 stars 64 forks source link

reverse_trans() for y-axis has odd side-effects #55

Closed thackl closed 3 years ago

thackl commented 3 years ago

Currently I use reverse_trans on the y-axis to get an intuitive order of genomes with the first at the top. This, however, has odd side-effects on y-based operations. For example, one need to use negative values to move thing upward, or use y-limits vom bigger to smaller to keep the reversed scale.

I think I do definitely want to keep the order of the bins with the first bin at the top, so just doing bin1: y=1, ... isn't an option. It might, however, work if I do an inverse mapping: bin_n: y=1, bin_n-1: y=2, bin_1: y=n. It's easy to change in the layout. Seems to mostly work. It does, however, break wrapping (which I would just have to reimplement for handed inverted coords).

This change, would, however, also introduce another inconsistency: currently pick(1) can be read as pick the first bin or the bin at y=1. If I do an inverted mapping, pick(1) should probably still reference the first bin, but it would then no longer match y...

thackl commented 3 years ago

This probably also would affect the alignment of genomes with a ggtree, i.e. pick_by_tree.