After installing dev version of the plotly (due to the fact that in the last version from cran api_create() generates grids for each trace, which is in my case a very huge number) I can’t set text on hover information.
I updated plot’s attributes using plotly_build() function:
ggpl<-mpg%>% group_by(class)%>% arrange(class, desc(order))%>% mutate(cum_size = cumsum(Size) - Size / 2)%>% ggplot(aes(x=class, y=cum_size, fill = manufacturer))+ geom_tile(color="white", size = 1, aes(height = Size)) pp<-ggplotly(ggpl) pp<-plotly_build(ggpl) mpg<-mpg[with(mpg, order(manufacturer,class,order)), ] pp$x$data[1:nrow(mpg)]<- Map(modifyList, pp$x$data[1:nrow(mpg)], lapply(paste("Class:",mpg$class,"<br> Year:",mpg$year, "<br> Model:",mpg$model, sep=" "), function(x) list(text=x))) pp
In my machine:
The published version’s code differs from that in code, which makes everybody very sad