Skip to content

Instantly share code, notes, and snippets.

@bhive01
Created May 16, 2020 05:25
Show Gist options
  • Save bhive01/2ac1fed2fd0280605c3d64161dfe60e2 to your computer and use it in GitHub Desktop.
Save bhive01/2ac1fed2fd0280605c3d64161dfe60e2 to your computer and use it in GitHub Desktop.
SHORTER!
---
title: 'Large Number of Plots Test'
output:
html_document:
keep_md: false
---
```{r setup, echo = FALSE}
library(knitr)
library(ggtext)
library(purrr)
library(ggplot2)
library(dplyr)
plot_data <- function(df) {
ggplot() +
geom_point(data = df, aes(x = x, y = y)) +
labs(caption = "<br>Pink dots represent outliers and are removed from downstream analyses.<br>Error bars represent the standard error of the mean.<br>ANOVA model significance *p* < 0.05.<br>Treatments with the same letter are not significantly different at *α* = 0.05 according to Tukey's HSD. ") +
theme(plot.caption = element_textbox_simple()) # utilize ggtext to add italics and wrap text
}
large <-
tibble(rep = 1:1200) %>%
mutate(
data = list(tibble(x = 1, y = 1)),
plots = map(data, ~ plot_data(.))
) %>%
{walk(.$plots, ~print(..1))}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment