ggplot2:..count ..不再使用stat_bin_hex了

时间:2016-05-27 15:39:22

标签: r ggplot2

几个月前,我能够毫无错误地制作以下情节:

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

1 个答案:

答案 0 :(得分:1)

这似乎与公开问题有关

  

geom_hex不再识别2.1.0#1608中的..density ..

Github

似乎必须解决这个问题。

更新2016-09-18:在Stackoverflow上查看this answer