ggtern error -> error-geom-point-requires-the-following-missing-aesthetics-x-and-y

Viewed 1224

There seems to be an issue with ggtern running with the new ggplot2. I have tried to load earlier versions of R, ggtern, and ggplot2 but cannot get them working. With the latest versions I get the following error:

Error: geom_point requires the following missing aesthetics: x and y

rlang::last_error()
<error/rlang_error>
geom_point requires the following missing aesthetics: x and y
Backtrace:

(function (x, ...) ...
ggtern:::print.ggplot(x)
ggtern:::ggplot_build.ggplot(x)
ggtern:::by_layer(function(l, d) l$compute_geom_1(d))
ggtern:::f(l = layers[[i]], d = data[[i]])
l$compute_geom_1(d)
ggplot2:::f(..., self = self)
ggplot2:::check_required_aesthetics(...)

rlang::last_trace()
<error/rlang_error>
geom_point requires the following missing aesthetics: x and y
Backtrace:
x

+-(function (x, ...) ...
-ggtern:::print.ggplot(x)
+-ggtern::ggplot_build(x)
-ggtern:::ggplot_build.ggplot(x)

\-ggtern:::by_layer(function(l, d) l$compute_geom_1(d))

  \-ggtern:::f(l = layers[[i]], d = data[[i]])

    \-l$compute_geom_1(d)

      \-ggplot2:::f(..., self = self)

        \-ggplot2:::check_required_aesthetics(...)

I have also tried loading ggtern before ggplot2 and loaded earlier versions of each package and R and RStudio.

Help!!!!

2 Answers

ggtern is not compatible with the latest version of ggplot2. You should use the version 3.2.1 (or maybe version 3.3.0)

require(devtools)
install_version("ggplot2", version = "3.2.1", repos = "http://cran.us.r-project.org")

If you need other packages of tidy verse you will have to load them separately.

I found the version combinations to get ggtern working again is:

R 4.0.2 ggplot2: 3.3.2 ggtern: 3.3.0 - ignore the warning...

Kind regards Knighty16

Related