User Request – Disable Limiting Region

[This article was first published on ggtern: ternary diagrams in R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The other week a user of ggtern ran into a problem where they wanted to use the limit_tern(...) functionality, however there were a few marginal points / paths that extended beyond the limiting region. Under normal circumstances, the standard ggtern behaviour is to strip these points, which can interfere with the desired outcome if they are part of a continuous path or polygon etc…

This is best demonstrated with an example:

library(ggtern)
data(Feldspar)
ggtern(data = Feldspar, aes(Ab, An, Or)) +
  geom_confidence(color="blue",linetype=1) + geom_point() +
  limit_tern(.85,1,.85) +
  labs(title = 'Feldspar - Elkins and Grove 1990 + Confidence Levels')

Which produces the following output:

plot of chunk unnamed-chunk-2

It is clear in the above that the tail ends get truncated, where truthfully they should flow over the boundaries of the plot region. There is a way to suppress this behaviour, which is to modify an internal global option, tern.discard.external, as follows:

library(ggtern)
data(Feldspar)
options("tern.discard.external" = FALSE)   ### NOTE THIS LINE
ggtern(data = Feldspar, aes(Ab, An, Or)) +
  geom_confidence(color="red",linetype=1) + geom_point() +
  limit_tern(.85,1,.85) +
  labs(title = 'Feldspar - Elkins and Grove 1990 + Confidence Levels')

Which produces the following output, noting that the tails (top and right apex corners) now extend beyond past the limiting plot region.

plot of chunk unnamed-chunk-2

Needless to say that this feature should be used on a discretionary basis, in very specific situations where a minor overflow can be tolerated.

The post User Request – Disable Limiting Region appeared first on ggtern: ternary diagrams in R.

To leave a comment for the author, please follow the link and comment on their blog: ggtern: ternary diagrams in R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)