我正在plotly
中创建一个R
对象:
library(plotly)
p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, text = ~Species, hoverinfo="text",
marker = list(size = 10,
color = 'rgba(255, 182, 193, .9)',
line = list(color = 'rgba(152, 0, 0, .8)',
width = 2))) %>%
layout(title = 'Styled Scatter',
yaxis = list(zeroline = FALSE),
xaxis = list(zeroline = FALSE))
如您所见,它包括hoverino
。
然后在某个时候我要删除该hoverinfo
层。
有什么想法吗?
答案 0 :(得分:1)
style(hoverinfo = 'none')
因此将它们放在一起:
(p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, text = ~Species, hoverinfo="text",
marker = list(size = 10,
color = 'rgba(255, 182, 193, .9)',
line = list(color = 'rgba(152, 0, 0, .8)',
width = 2))) %>%
layout(title = 'Styled Scatter',
yaxis = list(zeroline = FALSE),
xaxis = list(zeroline = FALSE)) %>%
style(hoverinfo = 'none'))