gpt4 book ai didi

r - ggplot2: ..count.. 不再使用 stat_bin_hex

转载 作者:行者123 更新时间:2023-12-04 00:28:11 24 4
gpt4 key购买 nike

几个月前,我能够毫无错误地生成以下图:

library(ggplot2)
library(hexbin)
x <- rnorm(100)
y <- rnorm(100, mean=2)
ggplot(data = data.frame(x,y)) + stat_bin_hex(aes(x=x, y=y, alpha=..count..), fill="#ED1A3A", bins=10)

现在这不再起作用了,我得到了错误

Error in eval(expr, envir, enclos) : Object 'count' not found

任何帮助我如何让它再次工作并解释为什么它不再工作?谢谢!

编辑 1:无论如何我的 session 信息:

R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin14.5.0 (64-bit)
Running under: OS X 10.11.5 (El Capitan)

locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8

attached base packages:
[1] grid stats graphics grDevices utils datasets methods base

other attached packages:
[1] hexbin_1.27.1 knitcitations_1.0.7 dplyr_0.4.3 XLConnect_0.2-11 XLConnectJars_0.2-9
[6] data.table_1.9.6 scales_0.4.0 ggplot2_2.1.0 gridExtra_2.2.1 extrafont_0.17
[11] np_0.60-2

loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 plyr_1.8.3 bitops_1.0-6 tools_3.2.3 boot_1.3-18
[6] digest_0.6.9 lattice_0.20-33 lubridate_1.5.6 gtable_0.2.0 bibtex_0.4.0
[11] DBI_0.4-1 yaml_2.1.13 parallel_3.2.3 rJava_0.9-8 Rttf2pt1_1.3.4
[16] knitr_1.13 stringr_1.0.0 httr_1.1.0 RefManageR_0.10.13 R6_2.1.2
[21] XML_3.98-1.4 rmarkdown_0.9.6 RJSONIO_1.3-0 extrafontdb_1.0 magrittr_1.5
[26] htmltools_0.3.5 assertthat_0.1 cubature_1.1-2 colorspace_1.2-6 labeling_0.3
[31] stringi_1.0-1 RCurl_1.95-4.8 lazyeval_0.1.10 munsell_0.4.3 chron_2.3-47

编辑 2:有趣的是它仍然适用于 stat_bin_2d

最佳答案

这似乎与 Unresolved 问题有关

geom_hex no longer recognizes ..density.. in 2.1.0 #1608

( Github )

这似乎还得解决。


2016-09-18 更新:查看 this answer在计算器上。

关于r - ggplot2: ..count.. 不再使用 stat_bin_hex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37487475/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com