在图表输出中添加图例工具提示

时间:2017-04-26 14:00:12

标签: r ggplot2 tooltip plotly

我有以下情节输出:

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

如何添加图例工具提示。例如,对于1,我想显示“猫”,两个我想显示“狗”......等等。

谢谢

0 个答案:

没有答案
相关问题