admin管理员组文章数量:1193356
I need to plot cartesian coordinates on a triangle to match a previous analysis. I have a data frame with the x,y values and I can generate a blank triangle using the Ternary library in R as follows:
par(mfrow = c(1, 2), mar = c(0.3, 0.3, 1.3, 0.3))
TernaryPlot(grid.lines = 0, ticks.col = "white")
As a sample of my df, say
x = c(-0.3463, 0.0002, -0.4330, -0.4329, -0.4330, -0.5773, -0.2885)
y = c(-0.20, 0, 0.25, -0.50, 0.25, -0.50, -0.50)
df = data.frame(x,y)
The only documentation I can find says it is possible to supply cartesian coordinates
arrows(x0 = 0.5, y0 = 0.4, x1 = sqrt(3) / 2, y1 = 0.4, length = 0.1,
col = cbPalette8[2])
text(x = mean(c(0.5, sqrt(3) / 2)), y = 0.4, "Increasing X", pos = 3,
col = cbPalette8[2])
text(x = 0.5, y = 0, "(0.5, 0)", col = cbPalette8[3])
text(x = 0.8, y = -0.5, "(0.8, -0.5)", col = cbPalette8[3])
but unfortunately it's not clear to me from the sample how to point to the plot to the df.
TernaryPoints(df[, c("x", "y")])
raises "Error in CoordinatesToXY(coordinates) : Coordinates must be ternary points"
I know this is doable, because I've seen the end product; just not sure how to get there. Advice is appreciated.
本文标签: plot cartesian coordinates with Ternary package in RStack Overflow
版权声明:本文标题:plot cartesian coordinates with Ternary package in R - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738454983a2087702.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论