Often one has data that is only found in a small region of the total space. When this happens, often one wants to zoom into that particular region. This can be done with tern_limits(). However, it is currently only possible to specify the limits manually. Would it be possible to add an automatic zoom argument for tern_limits()?
By automatic, I mean so that it automatically zooms into the smallest possible triangle that contains all points. Probably, one would want to round to the nearest 5/10/20 on the axes though.
To find the limits, find the max values of the three variables. Then round these to the nearest desired number. This is easy to do with plyr's round_any(). Then set the smallest number to the second smallest number. Then use these numbers.
I note that the order of tern_limits() does not match the order of arguments in the ggtern(aes(...)) call. E.g. The first given to ggtern() is the second to tern_limits(). So one has to rearrange them. You may want to rearrange these for consistency, but it may break prior plots.
Often one has data that is only found in a small region of the total space. When this happens, often one wants to zoom into that particular region. This can be done with
tern_limits()
. However, it is currently only possible to specify the limits manually. Would it be possible to add an automatic zoom argument fortern_limits()
?By automatic, I mean so that it automatically zooms into the smallest possible triangle that contains all points. Probably, one would want to round to the nearest 5/10/20 on the axes though.
To find the limits, find the max values of the three variables. Then round these to the nearest desired number. This is easy to do with plyr's
round_any()
. Then set the smallest number to the second smallest number. Then use these numbers.I note that the order of
tern_limits()
does not match the order of arguments in theggtern(aes(...))
call. E.g. The first given toggtern()
is the second totern_limits()
. So one has to rearrange them. You may want to rearrange these for consistency, but it may break prior plots.Here's an example. I use genomic admixture values from Bryc et al (2015)'s paper based on 23andme data. The data is here.