0

I have a matrix with 4 variables whereas 3 variables are parameters and the 4th variable gives the mean sum of squares for simulation results with the corresponding variables. Now I'd like to create a ternary plot with R where the triangle corresponding to the 3 parameter values should be colored by the mean sum of squares value. Alternatively, I'd like to plot interpolated mean sum of squares in the whole simplex triangle.

I was already looking for some functions or code that does what I'm looking for. But I didn't succeed.

Nevertheless, here's an example code of how my data set looks like (for which I'd like to create the ternary plot):

grid <- as.matrix(expand.grid(seq(0,0.5,0.025), seq(0,0.5,0.025), seq(-0.25,0.25,0.025)))
data <- cbind (grid, runif(9261,0,2))

I'd be very thankful if you'd provide R code that can create the plot I'd like to get. Maybe there's even a pre-implemented function in a package that I haven't found?!

Thanks a lot in advance for your help!

Anti
  • 365
  • 1
  • 14
  • 1
    You might look at the [Ternary package](https://cran.r-project.org/web/packages/Ternary/vignettes/Using-Ternary.html) – G5W Jun 14 '19 at 13:25
  • Thanks, @G5W. I already found that page yesterday but couldn't figure out how to do it. – Anti Jun 14 '19 at 19:21
  • 1
    The new [interpolation vignette](https://ms609.github.io/Ternary/articles/interpolation.html) might help here: but the underlying problem in this question is that `grid` does not correspond to points in a ternary plot (rows do not sum to 1) – so it's not quite clear what result is anticipated. – Martin Smith Mar 06 '23 at 15:42

0 Answers0