knitr::opts_chunk$set(echo = TRUE)
suppressPackageStartupMessages( require(tidyverse) ) suppressPackageStartupMessages( require(webshot) ) suppressPackageStartupMessages( require(rmarkdown) )
Here we want to try out the webshot
package in order to integrate htmlwidgets rendered as .png
or similar into .Rmd
documents.
p = ggplot(mtcars, aes(disp, mpg) ) + geom_point() plotly::ggplotly(p)
screenshot.force = TRUE
p = ggplot(mtcars, aes(disp, mpg) ) + geom_point() plotly::ggplotly(p)
.Rmd
with webshotwe will use example_ggpubr.Rmd
file_path = file.path( system.file(package = 'oetteR') , 'POC_Rmd' , 'POC_ggpubr.Rmd') rmdshot( file_path ) file.remove('webshot.png')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.