The goal of xplots is to easily save multiple plots stored in list columns of tibbles.
You can install the released version of xplots from GitHub with:
devtools::install_github("fkeck/xplots")
library(tidyverse)
iris_plots <- iris %>%
as_tibble() %>%
group_by(Species) %>%
nest() %>%
mutate(plots = map2(data, Species,
~ ggplot(.x, aes(Sepal.Length, Sepal.Width)) +
geom_point() +
labs(title = .y)
)
)
iris_plots
#> # A tibble: 3 x 3
#> Species data plots
#> <fct> <list> <list>
#> 1 setosa <tibble [50 × 4]> <gg>
#> 2 versicolor <tibble [50 × 4]> <gg>
#> 3 virginica <tibble [50 × 4]> <gg>
xplots::save_plots(iris_plots, plots, files = "myplot.pdf")
# If Ghostscript is available you can add bookmarks to the pdf.
xplots::save_plots(iris_plots, plots, files = "myplot_bkm.pdf",
bookmarks = vars(Species))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.