Img64Encoding <- function(g, height = 35, fromfile = TRUE) {
# Convert graphic .png-file
if (fromfile == FALSE) {
# Create a temporary png file and open that file for .png structured output.
# to add the grapic output to the file. Close file.
png(gtemp <- tempfile(fileext = ".png"))
print(g)
dev.off()
sprintf('<img src="%s" height="%f"/>', knitr::image_uri(gtemp), height)
} else {
sprintf('<img src="%s" height="%f"/>', knitr::image_uri(g), height)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.