[英]Add horizontal line to hoverinfo text in plotly in R
Is there a way to add an horizontal line to plotly hoverinfo box?有没有办法将水平线添加到情节悬停信息框? I want something that looks a little bit like that (the line, not the rest of the box) which was obtain with leaflet.
我想要一些看起来有点像(线条,而不是盒子的其余部分)的东西,这是通过传单获得的。
I thought it was possible to simply add the html tag <hr>
but it isn't working.我认为可以简单地添加 html 标签
<hr>
但它不起作用。
Here is a RE which also shows what I tried:这是一个 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")
As you can see in the figure below, the tag <br>
is understood but not the <hr>
.如下图所示,可以理解标签
<br>
,但不能理解<hr>
。
Any idea how to achieve this?知道如何实现这一目标吗?
From this help page , only some HTML tags are supported by plotly
:从这个帮助页面,
plotly
只支持一些 HTML 标签:
Plotly uses a subset of HTML tags to do things like newline (<br>), bold (<b></b>), italics (<i>), and hyperlinks (<a href='…'></a>).
Plotly 使用 HTML 标签的子集来执行诸如换行符 (<br>)、粗体 (<b></b>)、斜体 (<i>) 和超链接 (<a href='...'></a >)。 Tags <em>, <sup>, and <sub> are also supported.
还支持标签 <em>、<sup> 和 <sub>。
You could edit the plotly.js
file to add the missing tags.您可以编辑
plotly.js
文件以添加缺少的标签。 See var TAG_STYLES
in the source code .请参阅源代码中的
var TAG_STYLES
。
I considered using LaTeX , but unfortunately, LaTex typesetting is currently broken .我考虑过使用 LaTeX ,但不幸的是,LaTex 排版目前已损坏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.