limits_from_ggplot <- function(gg,
variable = "x"){
lim <- c(min(ggplot2::ggplot_build(gg)$data[[1]][variable],
na.rm = TRUE),
max(ggplot2::ggplot_build(gg)$data[[1]][variable],
na.rm = TRUE)
)
return(lim)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.