I have been creating a scatterplot matrix with hexagon bins using ggplotly for several months. Recently, I noticed a new warning message (which I do not believe was there a few months ago) when running ggplotly() on a ggmatrix object from ggpairs. I receive a warning message "Can only have one: highlight". I believe this message may be the root cause of issues happening downstream in one of my programs.
Does anyone have any ideas or advice on what may be causing these warning messages and how to solve them? Would I need to revert to a different/older version of plotly possibly? Below is a MWE (last line causes the warning).
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)
And below is my 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