研发ggplot:geom_tile 的更新问题

发布于 2024-09-14 17:46:24 字数 1040 浏览 3 评论 0原文

我最近安装了最新版本的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

翻身的咸鱼 2024-09-21 17:46:24

您还需要更新 plyr 包。

other attached packages:
[1] ggplot2_0.8.8  proto_0.3-8    reshape_0.8.3  plyr_1.1   

You also need to update the plyr package.

other attached packages:
[1] ggplot2_0.8.8  proto_0.3-8    reshape_0.8.3  plyr_1.1   
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文