我正在尝试使用networkD3和shiny来可视化一些数据.我希望在单击图表中的节点时执行操作.我正在使用对齐网络,如下面的代码所示.
forceNetwork可以选择在单击节点时进行"clickaction"响应.但是,我无法为diagonalNetwork找到类似的选项,还有另一种方法可以实现吗?
谢谢你的帮助!
#### Load necessary packages and data ####
library(shiny)
library(networkD3)
data(MisLinks)
data(MisNodes)
hc <- hclust(dist(USArrests), "ave")
URL <- paste0(
"https://cdn.rawgit.com/christophergandrud/networkD3/",
"master/JSONdata//flare.json")
## Convert to list format
Flare <- jsonlite::fromJSON(URL, simplifyDataFrame = FALSE)
#### Server ####
server <- function(input, output) {
output$simple <- renderDiagonalNetwork({
diagonalNetwork(List = Flare, fontSize = 10, opacity = 0.9)
})
output$force <- renderForceNetwork({
forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
Group = "group", opacity …Run Code Online (Sandbox Code Playgroud) I am trying to plot multiple subplots with shapes on each plot. From the following code below, if I display one plot I get the following plot:

When I position 4 copies of this plot in a subplot I get the following:

As you can see all of the 4 lines that should be drawn one on each subplot have all been drawn in the original position in the top left subplot. Any ideas how I can fix this?
** …