使用plot_ly抑制工具提示中的默认文本

时间:2016-04-01 09:35:42

标签: r plotly

使用plot_ly(),我可以在工具提示中添加我想要的内容,但我没有设法摆脱默认值。有没有办法做到这一点?

在下面的示例中,对于第一点,工具提示是" 250 company1"。我想只得到" company1"。我有一个使用ggplot2然后使用tooltip选项的ggplotly()的解决方案,但我宁愿只留下情节。

require(plotly)

seq <- 1:10
name <- c(paste0("company",1:10))
value <- c(250,125,50,40,40,30,20,20,10,10)
d <- data.frame(seq,name,value)
plot_ly(data=d,x=seq,y=value,text=name)

2 个答案:

答案 0 :(得分:11)

您需要hoverinfo的{​​{1}}参数:

plot_ly

更多阅读:plotly R chart attribute reference

答案 1 :(得分:1)

Gopala,我问了一个类似的问题,发现答案很有用。也许它对你也有帮助。

How can I remove the size line in the hoverinfo of a Plotly chart in R?