0

I am trying to generate response surface plots for ternary mixtures using ggtern. Using either geom_interpolate_tern() or stat_interpolate_tern() I receive the following error:

Warning message:
Computation failed in stat_interpolate_tern():
Number of x coordinates must match number of columns in density matrix.

Initially I was using my own data, but I have taken a step back and I am using the Feldspar data provided with the package. When I directly use the example from the documentation:

data(Feldspar)
ggtern(Feldspar,aes(Ab,An,Or,value=T.C)) + 
stat_interpolate_tern(geom="polygon",
                     formula=value~x+y,
                     method=lm,n=100,
                     breaks=seq(0,1000,by=100),
                     aes(fill=..level..),expand=1) +
                     geom_point()

I receive the same error and generate the following plot: Feldspar Ternary Plot with geom_point() and stat_interpolate_tern() But I should generate: Image from documentation

As you can see, the geom_point() layer displays correctly, and I have tested out a number of the other ggtern geoms which all function properly. I am using R 4.0.0 and ggtern 3.3.0. Anyone know what I am doing wrong here?

Scransom
  • 3,175
  • 3
  • 31
  • 51
Alex
  • 1
  • It looks like ggtern is not compatible with the newest ggplot version. We've seen problems in the axis labels (https://stackoverflow.com/questions/60989586/ggtern-breaks-ggplot2-and-produces-plots-without-axis-labels-etc). Maybe this interpolation is related – Daniel May 27 '20 at 14:42
  • Opened an issue in the project Bitbucket (https://bitbucket.org/nicholasehamilton/ggtern/issues/15/geom_interpolate_tern-not-working). But I'm not sure how frequent the package is maintained – Daniel May 27 '20 at 17:01

0 Answers0