I can't use ggtern to draw graph.

I updated the latest version of r language today. I find that I cannot draw graph use ggtern package. The wrong message is :":geom_point requires the following missing aesthetics: x and y.'' But I have defined x and y variables , I don't know how to fix it.

> ggtern(data=data.frame(x=2,y=4,z=3))+geom_point()
错误: geom_point requires the following missing aesthetics: x and y
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/rlang_error>
geom_point requires the following missing aesthetics: x and y
Backtrace:
 1. (function (x, ...) ...
 2. ggtern:::print.ggplot(x)
 4. ggtern:::ggplot_build.ggplot(x)
 5. ggtern:::by_layer(function(l, d) l$compute_geom_1(d))
 6. ggtern:::f(l = layers[[i]], d = data[[i]])
 7. l$compute_geom_1(d)
 8. ggplot2:::f(..., self = self)
 9. ggplot2:::check_required_aesthetics(...)
Run `rlang::last_trace()` to see the full context.
>rlang::last_trace()
<error/rlang_error>
geom_point requires the following missing aesthetics: x and y
Backtrace:
    x
 1. +-(function (x, ...) ...
 2. \-ggtern:::print.ggplot(x)
 3.   +-ggtern::ggplot_build(x)
 4.   \-ggtern:::ggplot_build.ggplot(x)
 5.     \-ggtern:::by_layer(function(l, d) l$compute_geom_1(d))
 6.       \-ggtern:::f(l = layers[[i]], d = data[[i]])
 7.         \-l$compute_geom_1(d)
 8.           \-ggplot2:::f(..., self = self)
 9.             \-ggplot2:::check_required_aesthetics(...)

Did you update R studio too?
R4.0.5 breaks R studio graphing and you need to update RStudio

I installed it once with my roommate’s computer, but it didn’t solve the problem. The problem still occurs on his computer. Maybe you can try to install it on your computer to see if the problem also occurs.

I try to install the new vision RStudio, but the problem happened again....

You have defined variables in a data frame but the error message is telling you that you haven't mapped any variable to the x and y aesthetic, in other words, you are missing arguments, see this example.

library(ggtern)

ggtern(data = data.frame(x=2,y=4,z=3), aes(x = x, y = y, z = z)) +
    geom_point()

Created on 2021-06-27 by the reprex package (v2.0.0)

It dose not work, the wrong message appeared again.

"ggtern(data = data.frame(x=2,y=4,z=3), aes(x = x, y = y, z = z)) +

  • geom_point()
    

Error: geom_point requires the following missing aesthetics: x and y
Run rlang::last_error() to see where the error occurred."

I try this both on my PC and Mac ,It doesn't work on both of my two computer. Before I update ggplot2,everything was fine ,but after I update R and ggplot2 yesterday, the wrong message appeared.

I can't reproduce your issue, I have shared a reproducible example and that is proof that the code I have shared with you actually works.

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

I have been using this package for a long time. All my codes can work normally before the upgrade, but after the upgrade they all can’t run. I tried to install these packages on my friend’s computer where the R language has never been installed. I also can't run these codes, I think there is a problem with ggtern.

It is very likely. I think your choices are, downgrade ggplot2 or contact the author of ggtern to file an issue report.

https://bitbucket.org/nicholasehamilton/ggtern/src/master/

OK,I will try to contact them, thank you for your comment!

Hi. I am having the same issue with code that worked on Friday but isn't working since Monday. Could you please update here if you have an answer?

I am also having the same problem!

I can run the exact same code that worked above

ggtern(data = data.frame(x=2,y=4,z=3), aes(x = x, y = y, z = z)) +
geom_point()

and that even works on an online R interface, but when I run it on my computer I get the same error

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

ggplot2 works fine, until I load ggtern, and then I get the same error when I try the ggplot code that worked before loading ggtern

Hi, I try to contact the author on ggtern's website, but I don't receive any reply until now.

Yes, I have the same problem too, if I library ggtern any ggplot2 codes will not work.

This problem has very bad effect on my research.....

Why don't you downgrade ggplot2 until the bug is fixed? You can install an older version with remotes

remotes::install_version("ggplot2", version = "3.3.2", repos = "http://cran.us.r-project.org")

Another possibility is to try with the development version of ggplot2

remotes::install_github("tidyverse/ggplot2")

Thanks , it works , but my tidyverse can not work after I install the old version of ggplot2 . What version of tidyverse we should install?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.