Monday, April 8, 2013

RG#29: Ternary plot

# data
X1 <- c(0.3, 0.2, 0.5, 0.6, 0.2, 0, 0, 0.004166667, 0.45)
X2 <- c(0.75,0.35,0,0.1,0.2,0.951612903,0.918103448,0.7875,0.45)
X3 <- c(0.15,0,0.5,0.3,0.6,0.048387097,0.081896552,0.208333333,0.1)
X4 <- c(100,2325,2503,1245, 551,-644,-377,-200, 2800)

dataf <- data.frame(X1, X2, X3, X4)

# plot
require(vcd)
ternaryplot(dataf[,1:3], dataf$X4)

 

1 comment:

  1. Hello Nicholas, I was wondering if it is possible to control the scale of the axes (sides of the triangle) to match data on different scale ranges. For example, I have data on %carbon (range: 30 to 60%), %nitrogen (range: 4 to 17%) and phosphorus (range: 0.5 to 2%). Thanks!

    ReplyDelete

Note: Only a member of this blog may post a comment.