我用ggplotly创建了一个带六边形分区的散点图矩阵几个月。最近,我注意到在ggpairs的ggmatrix对象上运行ggplotly()时出现了一条新的警告消息(我不相信它是几个月前的消息)。我收到一条警告信息"只能有一个:突出显示"。我相信这条消息可能是我的一个计划中下游发生问题的根本原因。
是否有人对可能导致这些警告信息的原因以及如何解决这些问题有任何想法或建议?我是否需要恢复到不同/旧版本的情节?下面是一个MWE(最后一行导致警告)。
library(GGally)
library(hexbin)
library(ggplot2)
library(plotly)
set.seed(1)
bindata <- data.frame(ID = paste0("ID",1:100), A=rnorm(100), B=rnorm(100), C=rnorm(100), D=rnorm(100))
bindata$ID <- as.character(bindata$ID)
################################ Prepare scatterplot matrix
###########################################################
maxVal = max(abs(bindata[,-1]))
maxRange = c(-1*maxVal, maxVal)
my_fn <- function(data, mapping, ...){
x = data[,c(as.character(mapping$x))]
y = data[,c(as.character(mapping$y))]
h <- hexbin(x=x, y=y, xbins=5, shape=1, IDs=TRUE, xbnds=maxRange, ybnds=maxRange)
hexdf <- data.frame (hcell2xy (h), hexID = h@cell, counts = h@count)
attr(hexdf, "cID") <- h@cID
p <- ggplot(hexdf, aes(x=x, y=y, fill = counts, hexID=hexID)) + geom_hex(stat="identity") + geom_abline(intercept = 0, color = "red", size = 0.25)
p
}
p <- ggpairs(bindata[,-1], lower = list(continuous = my_fn))
pS <- p
for(i in 2:p$nrow) {
for(j in 1:(i-1)) {
pS[i,j] <- p[i,j] +
coord_cartesian(xlim = c(maxRange[1], maxRange[2]), ylim = c(maxRange[1], maxRange[2]))
}
}
ggPS <- ggplotly(pS)
以下是我的sessionInfo()
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Mavericks 10.9.5
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tidyr_0.6.1 hexbin_1.27.1 GGally_1.3.0 data.table_1.10.4 plotly_4.5.6.9000
[6] ggplot2_2.2.1.9000 shiny_1.0.1 htmlwidgets_0.8
loaded via a namespace (and not attached):
[1] Rcpp_0.12.10 magrittr_1.5 munsell_0.4.3 lattice_0.20-35 viridisLite_0.2.0
[6] colorspace_1.3-2 xtable_1.8-2 R6_2.2.0 httr_1.2.1 plyr_1.8.4
[11] dplyr_0.5.0 tools_3.3.2 grid_3.3.2 gtable_0.2.0 DBI_0.6-1
[16] crosstalk_1.0.1 htmltools_0.3.5 yaml_2.1.14 lazyeval_0.2.0 digest_0.6.12
[21] assertthat_0.1 tibble_1.3.0 RColorBrewer_1.1-2 purrr_0.2.2 base64enc_0.1-3
[26] mime_0.5 labeling_0.3 scales_0.4.1.9000 reshape_0.8.6 jsonlite_1.4
[31] httpuv_1.3.3