##' extract the legend of a \code{ggplot} object
##'
##' @param plot a \code{ggplot} object
##' @export
##'
extract_legend <- function(plot)
{
legend = ggplotGrob(plot)$grobs
legend[[which(sapply(legend,function(x)x$name) == "guide-box")]]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.