# NOT RUN {
# loading the necessary libraries
library(ggplot2)
# preparing the first plot
p1 <-
ggplot2::ggplot(
data = subset(iris, iris$Species == "setosa"),
aes(x = Sepal.Length, y = Sepal.Width)
) +
geom_point() +
labs(title = "setosa")
# preparing the second plot
p2 <-
ggplot2::ggplot(
data = subset(iris, iris$Species == "versicolor"),
aes(x = Sepal.Length, y = Sepal.Width)
) +
geom_point() +
labs(title = "versicolor")
# combining the plot with a title and a caption
combine_plots2(
plotlist = list(p1, p2),
plotlist.args = list(labels = c("(a)", "(b)")),
title.text = "Dataset: Iris Flower dataset",
caption.text = "Note: Only two species of flower are displayed",
title.args = list(color = "red"),
caption.args = list(color = "blue")
)
# }
Run the code above in your browser using DataLab