Hi Nick,
thanks for providing ggtern. I have tried to use it for visualizing a 3D Dirichlet density with the code below. The behavior of the function should be completely symmetric with respect to the three variables. However, the code produces a non-symmetric picture. (Swapping variable names x1 and x3 leaves the anomality between x1 and x2, so it must be the interpolation that does this.) To me, this looks like a bug in the interpolation behavior. Or am I doing something wrong?
Best, Ulrike
Hi Nick, thanks for providing ggtern. I have tried to use it for visualizing a 3D Dirichlet density with the code below. The behavior of the function should be completely symmetric with respect to the three variables. However, the code produces a non-symmetric picture. (Swapping variable names x1 and x3 leaves the anomality between x1 and x2, so it must be the interpolation that does this.) To me, this looks like a bug in the interpolation behavior. Or am I doing something wrong? Best, Ulrike
`require(gtools) require(ggplot2) require(ggtern)
x1 <- c(0.0001, seq(0.01,0.99,0.01), 0.9998) x2 <- c(0.0001, seq(0.01,0.99,0.01), 0.9998) x3 <- c(0.0001, seq(0.01,0.99,0.01), 0.9998)
mat <- as.matrix(expand.grid(x1,x2,x3)) colnames(mat) <- c("x1","x2","x3") mat <- mat[rowSums(mat)==1,] dichte <- gtools::ddirichlet(x=mat, rep(0.5,3)) mat <- as.data.frame(cbind(100*mat, dichte=dichte)) ggtern(data=as.data.frame(mat), aes(x=x1,y=x2,z=x3, value=dichte)) + stat_interpolate_tern(method = "loess", bins=2000) `