changing background image within forceNetwork

Viewed 226

Changing the background color of a networkD3 can be achieved by hijacking some arguments of the forceNetwork function as @Jota demonstrated here : Change background color of networkD3 plot.

How would this be extrapolated to changing the background image ?

I have tried few ways without success one of them as follows :

library(networkD3)
library(htmltools)

data(MisLinks)
data(MisNodes)

browsable(
  tagList(
         forceNetwork(Links = MisLinks, Nodes = MisNodes,
             Source = "source", Target = "target",
             Value = "value", NodeID = "name",
             Group = "group", opacity = 0.8),
      tags$script('document.body.style.backgroundImage = "url(paper.gif)"')
    )
   )

Is there a way to alter the background-image in a similar manner as follows :
linkDistance = JS('function(){d3.select("body").style("background-color", "#910e33"); return 50;}')) ?

1 Answers
Related