visnetwork r中的表达标签

时间:2018-10-11 19:17:09

标签: r expression subscript superscript visnetwork

是否可以在vis网络中的节点标签上使用下标或上标的表达式? 还是可以在绘图后更改标签?

 nodes <- data.frame(id = 1:10,

                # add labels on nodes
                label = paste("N[", 1:10,"]", sep = ""),

                # add groups on nodes 
                group = c("GrA", "GrB"),

                # size adding value
                value = 1:10,          

                # control shape of nodes
                shape = c("square", "triangle", "box", "circle", "dot", "star",
                          "ellipse", "database", "text", "diamond"),

                # tooltip (html or character), when the mouse is above
                title = paste0("<p><b>", 1:10,"</b><br>Node !</p>"),

                # color
                color = c("darkred", "grey", "orange", "darkblue", "purple"),

                # shadow
                shadow = c(FALSE, TRUE, FALSE, TRUE, TRUE))             

# head(nodes)
# id  label group value    shape                     title    color shadow
#  1 Node 1   GrA     1   square <p><b>1</b><br>Node !</p>  darkred  FALSE
#  2 Node 2   GrB     2 triangle <p><b>2</b><br>Node !</p>     grey   TRUE

edges <- data.frame(from = c(1,2,5,7,8,10), to = c(9,3,1,6,4,7))

visNetwork(nodes, edges, height = "500px", width = "100%")

0 个答案:

没有答案