Вот решение.Требуется отредактировать связанный файл JS.Я не верю, что есть более простой способ обойти это.Вы можете легко создать функцию из приведенного ниже кода.
# Load package
library(networkD3)
# Create a network graph.
src <- c("A", "A", "A", "A",
"B", "B", "C", "C", "D")
target <- c("B", "C", "D", "J",
"E", "F", "G", "H", "I")
networkData <- data.frame(src, target)
# Create widget.
widget <- simpleNetwork(networkData)
# Define (temporary) path to where the widget will be saved.
file <- tempfile(pattern = "file", tmpdir = dir <- tempdir(), fileext = ".html")
# Save widget.
htmlwidgets::saveWidget(widget, file = file, selfcontained = FALSE)
# Define path to where js file is we want to edit.
js_path <- paste0(dir, "/", gsub(".*\\\\|\\..*", "", file), "_files/forceNetwork-binding-0.4/forceNetwork.js")
# Read in JS file.
js <- readLines(js_path)
# Edit relevant line so that no transparency occurs on hover.
js <- gsub("var unfocusDivisor = 4;", "var unfocusDivisor = 1;", js)
writeLines(js, con = js_path)
# Open graph
browseURL(paste0("file://", file))