ggplot2:..count ..不再与stat_bin_hex一起工作 [英] ggplot2: ..count.. not working with stat_bin_hex anymore
问题描述
几个月前,我能够无误地生成以下图:
library(ggplot2)
library (十六进制)
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)
现在这不再起作用了,我得到错误
eval中的错误(expr,envir ,enclos):找不到对象'count'
任何帮助我如何重新开始工作并解释为什么它不再工作了?
谢谢!
编辑1 :无论如何我的会话信息:
R版本3.2.3(2015-12-10)
平台:x86_64-apple-darwin14.5.0(64位)
在OS下运行X 10.11.5(El Capitan)
区域设置:
[1] de_DE.UTF-8 / de_DE.UTF-8 / de_DE.UTF-8 / C / de_DE.UTF-8 /de_DE.UTF-8
附加基础包:
[1]网格统计图形grDevices utils数据集方法基础
其他附加包:
[ 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
通过名称空间加载(并未附加):
[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不再识别..density .. in 2.1.0#1608
( Github )
似乎必须修复,但是。
更新2016-09-18:结帐这个答案在Stackoverflow上。
Some months ago I was able to produce the following plot without errors:
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)
Now this does not work anymore and I get the error
Error in eval(expr, envir, enclos) : Object 'count' not found
Any help how I get this working again and explanation why its not working anymore? Thanks!
EDIT 1: My session info in any case:
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
EDIT 2: Interestingly it still works with stat_bin_2d
.
This seems to be related to the open issue
geom_hex no longer recognizes ..density.. in 2.1.0 #1608
(Github)
that seems to have to fix, yet.
Update 2016-09-18: Check out this answer on Stackoverflow.
这篇关于ggplot2:..count ..不再与stat_bin_hex一起工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!