研发ggplot:geom_tile 的更新问题
我最近安装了最新版本的 ggplot,从 CRAN 下载源代码,然后运行
install.packages("/path/to/ggplot2_0.8.8.tar.gz", repos = NULL, type="source")
现在,运行 ggplot2 网站上 geom_tile() 文档中的第一个示例:
library('ggplot2')
pp <- function (n,r=4) {
x <- seq(-r*pi, r*pi, len=n)
df <- expand.grid(x=x, y=x)
df$r <- sqrt(df$x^2 + df$y^2)
df$z <- cos(df$r^2)*exp(-df$r/6)
df
}
p <- ggplot(pp(20), aes(x=x,y=y))
p + geom_tile(aes(fill=z))
给出以下错误:
Error in get("make_aesthetics", env = x, inherits = TRUE)(x, ...) :
could not find function "empty"
有人有任何想法吗?
> sessionInfo()
R version 2.10.1 Patched (2010-01-25 r51042)
x86_64-apple-darwin9.8.0
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] ggplot2_0.8.8 proto_0.3-8 reshape_0.8.3 plyr_0.1.9
I've recently installed the latest version of ggplot, by downloading the source from CRAN and then running
install.packages("/path/to/ggplot2_0.8.8.tar.gz", repos = NULL, type="source")
Now, running the first example from geom_tile()'s documentation on the ggplot2 website:
library('ggplot2')
pp <- function (n,r=4) {
x <- seq(-r*pi, r*pi, len=n)
df <- expand.grid(x=x, y=x)
df$r <- sqrt(df$x^2 + df$y^2)
df$z <- cos(df$r^2)*exp(-df$r/6)
df
}
p <- ggplot(pp(20), aes(x=x,y=y))
p + geom_tile(aes(fill=z))
gives the following error:
Error in get("make_aesthetics", env = x, inherits = TRUE)(x, ...) :
could not find function "empty"
Anyone got any ideas?
> sessionInfo()
R version 2.10.1 Patched (2010-01-25 r51042)
x86_64-apple-darwin9.8.0
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] ggplot2_0.8.8 proto_0.3-8 reshape_0.8.3 plyr_0.1.9
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还需要更新
plyr
包。You also need to update the
plyr
package.