几个月前,我能够产生以下图表而没有错误:

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:无论如何,我的会话信息:

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

最佳答案

这似乎与未解决的问题有关


geom_hex不再识别2.1.0#1608中的..密度


Github

这似乎必须解决。



2016年9月18日更新:在Stackoverflow上查看this answer

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

10-12 17:09