datastorm-open / visNetwork

R package, using vis.js library for network visualization
Other
542 stars 127 forks source link

Can't change figure size in R markdown #455

Open nickschurch opened 1 year ago

nickschurch commented 1 year ago

I have some visNetwork graphs that I make in an R markdown document. I don't seem to be able to alter the size of the viewport with either the R markdown chunk options (fig.width, fig.height) or with any of the visNetwork options, either when running the script in Rstudio or when knitting it to an html document.

Anyone got any ideas on how I can control this?

nickschurch commented 1 year ago

I found a way to do this for the knit version. You add the following to a css file and add it to the html output yaml config in the markdown:

body {
  max-width: 4000px !important;
  margin: auto;
  padding: 1em;
}

.main-container {
  width: 100% !important;
  max-width: 4000px !important;
}

No solution yet though when running it inside Rstudio...