Ich versuche, das ggplot geom_bar
Beispiel zu reproduzieren, das ich here gefunden habe. Der Code ist ziemlich einfachFehlende Tooltips und redundante Legende mit ggplotly mit geom_bar
library(ggplot2)
library(plotly)
dat <- data.frame(
time = factor(c("Lunch","Dinner"), levels=c("Lunch","Dinner")),
total_bill = c(14.89, 17.23))
# No legend, since the information is redundant
ggplot(data=dat, aes(x=time, y=total_bill, fill=time)) +
geom_bar(colour="black", stat="identity") +
guides(fill=FALSE)
ggplotly()
Im ggplot die Fill-Legende versteckt ist wie erwartet, aber das unterscheidet plotly aus dem Beispiel:
- die Legende enthalten ist
- die Tooltips nicht arbeiten
Da ich erwarten, dass dies im Zusammenhang ein Problem sein Versionen zu verpacken ich meine sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=German_Austria.1252 LC_CTYPE=German_Austria.1252 LC_MONETARY=German_Austria.1252 LC_NUMERIC=C LC_TIME=German_Austria.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] plotly_4.5.6 ggplot2_2.2.1 nvimcom_0.9-19
loaded via a namespace (and not attached):
[1] Rcpp_0.12.8 tidyr_0.6.0 viridisLite_0.1.3 digest_0.6.10 dplyr_0.5.0 assertthat_0.1 grid_3.3.2 plyr_1.8.4 R6_2.2.0 jsonlite_1.1 gtable_0.2.0 DBI_0.5-1
[13] magrittr_1.5 scales_0.4.1 httr_1.2.1 lazyeval_0.2.0 tools_3.3.2 htmlwidgets_0.8 purrr_0.2.2 munsell_0.4.3 base64enc_0.1-3 colorspace_1.3-1 htmltools_0.3.5 tibble_1.2
'p <- ggplotly(); p $ x $ Daten [[1]] $ Text <- c (p2 $ x $ Daten [[1]] $ Text," "); p $ x $ Daten [2]] $ text <- c (p2 $ x $ Daten [[2]] $ Text, ""); p'? Siehe http://stackoverflow.com/questions/41184959/plotly-ggplot2-some-tooltips-missing-in-stacked-barplot – lukeA
Vielen Dank! Dies (mit p anstelle von p2) löst das Problem mit Tooltips. Irgendeine Idee über die Legende? – supersambo
Einen Fehlerbericht zu [GitHub] abgelegt (https://github.com/opensci/plotly/issues/842). –