Change background color of networkD3 plot

Viewed 1599

Say I make a networkD3 plot - using the minimal example in the package

#
library(networkD3)

# Load data
data(MisLinks)
data(MisNodes)

# Plot
forceNetwork(Links = MisLinks, Nodes = MisNodes,
            Source = "source", Target = "target",
            Value = "value", NodeID = "name",
            Group = "group", opacity = 0.8)

If I open this in the browser, I can use developer tools to change the background color of body to e.g. background-color: #DAE3F9;"

Is there a way to automatically define background color of a plot (From default white) to another color, without opening in the browser ? Basically, can we add CSS directly to the code like we can add JS functions?

2 Answers
Related