I have “simple” plot in ggplot and would like to wrap it with ggplotly. I specify a bar color using fill= and when I do the bar inacticivity goes away.
library(ggplot2)
library(plotly)
cnt <-c(2,1)
date <- c(“2016-01-05 13:53:43”,“2016-01-15 09:33:40”)
xx.df <- data.frame(date,cnt)
xx.df$datep <- as.Date(xx.df$date,format="%Y-%m-%d %H:%M:%S")
xx.df$datea <- as.character(xx.df$date,format="%Y-%m-%d %H:%M:%S")
xx.df$status <- as.factor(c(“Success”,“Fail”))
pa <- ggplot(xx.df,aes(x=datea,y=cnt,fill=status))
pa <- pa+geom_bar(stat=“identity”)
print(ggplotly(pa))
- I can’t click to remove a series using the legend, both bars go away.
- Mouse hover is not present.
When I remove fill= I get a grey plot without a legend. But the mouse hover works…
pag <- ggplot(xx.df,aes(x=datea,y=cnt))
pag <- pag+geom_bar(stat=“identity”)
print(ggplotly(pag))
Is there an issue with how I used the fill=? I am using plotly 4.5.6,ggplot2 2.2.1
Thanks,
Richard