当前具有以下代码:
nodes <- data.frame(id = 1:3, label = letters[1:3])
edges <- data.frame(from = c(1,2), to = c(1,3))
# Define UI
ui <- shinyUI(fluidPage(
visNetworkOutput("network"),
actionButton("removelabels", "Remove letters from nodes!")
))
# Define server
server <- shinyServer(function(input, output) {
output$network <- renderVisNetwork({
visNetwork(nodes, edges) %>% visOptions(highlightNearest = TRUE) %>%
visPhysics(enabled = FALSE) %>% visEdges(smooth = FALSE)
})
})
# format positions
# Run the application
shinyApp(ui = ui, server = server)
我想在R中找到一种方法,当我单击操作按钮创建图时,将从图上删除标签-但是图本身不会在每个实例上重新运行-所以我想像visNetworkProxy(“ network”)%>%visNodes(labels = NULL)之类的-但是我的标签在我的节点数据框中,并且我无法更改!
欢迎任何想法的帮助
tl; dr
创建图形后,删除标签-但不能一起重新运行图形-使用visNetworkProxy或其他方法