I would like to add jpeg picture in a place of 'ao' in the following figure
library(ggplot2)
da <- data.frame(x = seq(0, 100, 1), y = seq(0, 1, 0.01))
ao <- ggplot()
a1 <- ggplot(aes(x = x, y = y), data = da) + geom_line()
a2 <- ggplot(aes(x = x, y = y), data = da) + geom_point()
a3 <- ggplot(aes(x = x, y = y), data = da) + geom_line(lty = 2)
library(cowplot)
plot_grid(ao, a1, a2, a3, labels=c("a)", "c)", "b)", "d)"), ncol = 2, nrow = 2)
I am not restricted to ´cowplot´ library. anything that works is fine.
Ok, I finally solved it like that
library(ggplot2)
ao <- ggplot()
image <- load.image("FIGURE/xxxx.png")
library(magick)
a0 <- ggdraw(a0) + draw_image(image)
da <- data.frame(x = seq(0, 100, 1), y = seq(0, 1, 0.01))
a1 <- ggplot(aes(x = x, y = y), data = da) + geom_line()
a2 <- ggplot(aes(x = x, y = y), data = da) + geom_point()
a3 <- ggplot(aes(x = x, y = y), data = da) + geom_line(lty = 2)
library(cowplot)
plot_grid(ao, a1, a2, a3, labels=c("a)", "c)", "b)", "d)"), ncol = 2, nrow = 2)