Plotly具有同时显示多行的悬停文本的功能。例如:
dt <- data.table(x = 1:10, y = rnorm(10), z = rnorm(10)+2)
plot_ly(type = "scatter", mode = "lines") %>%
add_trace(x = dt$x, y = dt$y, name = "curve 1", mode = "lines") %>%
add_trace(y = dt$z, name = "curve 2", mode = "lines")
但是,如果他们的模式不同,则悬停文本不会被分组。例如:
dt <- data.table(x = 1:10, y = rnorm(10), z = rnorm(10)+2)
plot_ly(type = "scatter", mode = "lines") %>%
add_trace(x = dt$x, y = dt$y, name = "curve 1", mode = "lines+markers") %>%
add_trace(y = dt$z, name = "curve 2", mode = "lines")
在python中有一个方法可以做到这一点(Line Plot Modes) 我无法在R中找到解决方案。
由于