Skip to content

ggplotly: Some tooltips missing in stacked barplot #831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
luke-a opened this issue Dec 17, 2016 · 2 comments
Closed

ggplotly: Some tooltips missing in stacked barplot #831

luke-a opened this issue Dec 17, 2016 · 2 comments
Labels

Comments

@luke-a
Copy link

luke-a commented Dec 17, 2016

(Crossposted from Stackoverflow.com: ) Given for example

library(ggplot2)
library(plotly)
df <- data.frame(V1=gl(6,20), V2=gl(40,3))
p <- ggplot(df, aes(x=V1, fill=V2)) + geom_bar(color="white")
ggplotly(p)

ggplotly

some bar segments show no tooltip/hover information, whereas the legend displays the huge number of factor levels nicely (=scroll bar). How can I fix this?

I'm using

packageVersion("ggplot2")
# [1] ‘2.2.0’
packageVersion("plotly")
# [1] ‘4.5.6’
@ghost
Copy link

ghost commented Dec 26, 2016

adding some code. We can fix it:

library(ggplot2)
library(plotly)
df <- data.frame(V1=gl(6,20), V2=gl(40,3))
p <- ggplot(df, aes(x=V1, fill=V2)) + geom_bar(color="white")
fixed<-ggplotly(p)

for (i in 1:length(levels(df$V2))){
  fixed$x$data[[i]]$text[length(fixed$x$data[[i]]$text)+1] <- c("")
}
fixed

captura de pantalla de 2016-12-26 14-22-03

@cpsievert
Copy link
Collaborator

This appears to be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants