I tried to add captions in some plots that will be shown in a .rmd file, but the captions added are not very aesthetically pleasing. It will look much better if I just include the captions in the .rmd file instead of the plot. Are there any ways to make the captions look prettier in ggplot2?
library(ggplot2)
data <- data.frame(col = c("left", "right"),
row = c("first", "second", "third", "fourth"),
x = rep.int(1,4),
y = rep.int(1,4))
data$col <- as.character(data$col)
data$row <- as.character(data$row)
caption <- paste(strwrap("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", width = 170), collapse = "\n")
ggplot(data = data) +
facet_grid(row~col) +
labs(x = "x", y = "y", caption = caption) +
theme_bw(base_size = 16) +
theme(legend.position = "bottom",
plot.margin = margin(15, 15, 15, 15),
plot.caption = element_text(size = 10, hjust = 0))
The captions that I added