How to keep a forceNetwork {networkD3} centered in a Shiny app?
问题 While building a Shiny app that displays a forceNetwork graph, the network does not stay centered but moves out of view when one interactively changes the opacity. My question is, how to change this behavior and keep the network nicely centered as it was initially? A reproducible example: ui.R: library(shiny) library(networkD3) shinyUI(fluidPage( titlePanel("ForceNetD3"), sidebarLayout( sidebarPanel( sliderInput("opacity", "Opacity", min = 0.1, max = 1, value = 0.4) ), mainPanel(