Plotly R hovertext over line / shapes

时间:2017-12-20 10:46:55

标签: r plotly

是否可以将悬停信息添加到线条/形状对象?

以下代码生成一个带有2个点上的悬停信息的图。

library(plotly)

line <- list(type = "line", line = list(color = "black"), xref = "x", 
             yref = "y", x0 = 0, x1 = 1, y0 = 1, y1 = 1)

plot_ly(data.frame(i = 0:1, j = 1:2), x = ~i, y =~j, hoverinfo = "text", 
        text = ~c("p1", "p2")) %>% 
add_markers() %>% 
plotly::layout(shapes = line)

是否有可能添加类似

的内容
%>% plotly::layout(shapes = line, text = "l1")

通过线路获取悬停信息? (显然这段代码不起作用。)

0 个答案:

没有答案