View source: R/epi_plot_cow_save.R
epi_plot_cow_save | R Documentation |
epi_plot_cow_save() A light wrapper to save plots to disk with cowplot::save_plot()
epi_plot_cow_save(
file_name = NULL,
plot_grid = NULL,
base_height = 11.69,
base_width = 8.27,
...
)
file_name |
Name of the file to save |
plot_grid |
plot to save, more often expecting a grid. |
base_height |
Height in inches of the plot. Default is 11.69 (A4 size) |
base_width |
Width in inches of the plot. Default is 8.27 (A4 size) |
... |
Pass any other parameter from cowplot::save_plot() |
None, file saved to disk.
height and width are for A4 size. See also ggplot2 wrappers epi_plot_*().
Antonio Berlanga-Taylor <\url{https://github.com/AntonioJBT/episcout}>
epi_plot_list
,
epi_plots_to_grid
,
plot_grid
,
save_plot
.
## Not run:
set.seed(12345)
n <- 20
df <- data.frame(var_id = rep(1:(n / 2), each = 2),
var_to_rep = rep(c("Pre", "Post"), n / 2),
x = rnorm(n),
y = rbinom(n, 1, 0.50),
z = rpois(n, 2)
)
df
df[, 'var_id'] <- as.character(df[, 'var_id'])
vars_to_plot <- df %>%
select_if(epi_clean_cond_numeric) %>%
names()
my_plot_list <- epi_plot_list(vars_to_plot)
my_plot_list
# Generate plots:
for (i in names(my_plot_list)) {
print(i)
my_plot_list[[i]] <- ggplot2::ggplot(df, aes_string(y = i)) + geom_boxplot()
}
# Pass to a grid and save to file:
# length(my_plot_list)
my_plot_grid <- epi_plots_to_grid(my_plot_list[1:length(my_plot_list)])
epi_plot_cow_save(file_name = 'plots_1.pdf', plot_grid = my_plot_grid)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.