I want to tag the plots: A1, A2, B. I can get A-C and A1-A3 but not what I am after, what am I missing?
#Grid layout
grid <- "
AABB
CCCC
"
#the following tags A-C
patchwork <- p1 + p2 + p3 +
plot_layout(design = grid, guides = "collect", tag_level = 'new')
patchwork + plot_annotation(tag_levels = c("A","1"))
#the followign tags A1- A3
wrap_plots(p1 + p2 + p3 +
plot_layout(design = grid, guides = "collect", tag_level = 'new'))
#data:
p1 <- ggplot(mpg) +
geom_point(aes(x = displ, y = hwy))
p2 <- ggplot(mpg) +
geom_bar(aes(x = as.character(year), fill = drv), position = "dodge") +
labs(x = "year")
p3 <- ggplot(mpg) +
geom_density(aes(x = hwy, fill = drv), colour = NA) +
facet_grid(rows = vars(drv))
p4 <- ggplot(mpg) +
stat_summary(aes(x = drv, y = hwy, fill = drv), geom = "col",
fun.data
= mean_se) +
stat_summary(aes(x = drv, y = hwy), geom = "errorbar",
fun.data
= mean_se, width = 0.5)