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?