visNetwork中的多行头衔

时间:2017-02-13 10:16:00

标签: html r

在R中,我如何在visNetwork中拥有多行标题? \n似乎不是解决方案:

require(visNetwork, quietly = TRUE) 
# minimal example 
nodes <- data.frame(id = 1:3) 
edges <- data.frame(from = c(1,2), to = c(1,3)) 
visNetwork(nodes, edges, main ="multi \n line \n title")

enter image description here

1 个答案:

答案 0 :(得分:2)

互动visNetwork使用HTML代替标准绘图 使用HTML的新换行代码<br>

visNetwork(nodes, edges, main ="multi<br>line<br>title")

要在左侧对齐,或应用任何其他样式,请使用命名列表作为main的参数:

visNetwork(nodes, edges, main = list(
                                 text = "multi<br>line \n title", 
                                 style = "font-family:Comic Sans MS;color:#ff0000;
                                          font-size:15px;text-align:left;"))