【发布时间】:2017-10-07 13:18:49
【问题描述】:
今天我试图运行以前运行良好的代码。但我收到以下错误:
> p1 <- ggplot(dframe, aes(x, y, text=sprintf("letter: %s<br>LETTER: %s<br>", a, b))) + geom_line() + geom_point()
> ggplotly(p1)
We recommend that you use the dev version of ggplot2 with `ggplotly()`
Install it with: `devtools::install_github('hadley/ggplot2')`
Error in FUN(X[[i]], ...) : object 'x' not found
我的数据集如下所示:
seq <- 1:10
name <- c(paste0("company",1:10))
value <- c(250,125,50,40,40,30,20,20,10,10)
lett <- letters[1:10]
dframe <- data.frame(seq,name,value,lett)
我的环境:
- “R 版本 3.4.2 (2017-09-28)”
- ggplot2 2.2.1
- 情节 4.7.1
为什么会这样?谢谢
【问题讨论】:
-
尝试使用
label而不是text -
我尝试过使用
text、label和key过去都可以,但现在都返回相同的错误。 -
您是否将
x和y映射到dframe变量? -
哦,这么愚蠢的错误,非常感谢。我不得不以某种方式搞砸数据集,请将其作为答案发布,以便我接受。