有没有办法在plotly hoverinfo框中添加水平线?我想要的东西看起来有点像(线条,而不是盒子的其余部分),这是用传单获得的。
我认为可以简单地添加html标签<hr>
但它不起作用。
这是一个RE,它也显示了我尝试过的内容:
library(plotly)
set.seed(123)
dd <- data.frame(
xx = rnorm(10),
yy = rnorm(10),
ff = as.factor(c("a","b","c","a","b","c","a","a","b","c")),
ss = round(runif(10, 100,1000))
)
pp <- plot_ly(data = dd,
x = ~xx,
y = ~yy,
hoverinfo = 'text',
text = ~paste(ff,
'</br></hr>',
"</br>value:", ss,
'</br><hr>',
'</br><hr><hr/>',sep=""))
add_markers(pp,mode = "markers")
正如您在下图中所见,标签<br>
被理解,但不是<hr>
。
知道怎么做到这一点?
从这个help page,plotly
只支持一些HTML标签:
Plotly使用HTML标记的子集来执行换行(<br>),粗体(<b> </ b>),斜体(<i>)和超链接(<a href='...'> </ a >)。还支持标签<em>,<sup>和<sub>。
你可以edit the plotly.js
file添加缺少的标签。请参阅var TAG_STYLES
中的source code。
我考虑过using LaTeX,但不幸的是,LaTex排版is currently broken。