library(ggplot2) library(plotly) library(htmlwidgets)

p <- ggplot(mpg, aes(x = displ, y = hwy, color = class)) + geom_point()

Converteer naar interactieve plotly grafiek

p_plotly <- ggplotly(p)

Opslaan als HTML-bestand

saveWidget(p_plotly, “plot.html”, selfcontained = TRUE)

Open in browser

browseURL(“plot.html”)

rmarkdown::render(“plot_rapport.Rmd”)