I am trying to generate a panel that includes some plots and some images, similar to https://www.biorxiv.org/content/biorxiv/early/2020/01/09/2020.01.08.894881/F1.large.jpg
To import the images, I'm using magick and ggpubr packages to make them grob:
p1 <- magick::image_read(here(path_data, "image.png"))
p1 <- ggplot()+ggpubr::background_image(p1)
And I'm generating the plots with ggplot.
After that, I tried to combine both kinds of elements with patchwork cowplot packages that can generate a grid with labels:
p1+p2+p3+p4+p5+p6+plot_annotation(tag_levels = 'a')+plot_layout(ncol=3) #using patchwork
cowplot::plot_grid(p1, p2, p3, p4, p5, p6, ncol=3, labels = "auto") #using cowplot
The problem that I have is that the images ("image.png") do not maintain the format and try to fill all the space. In the example image, panel e would appear elongated, losing the original proportion.
How can I include the images while they maintain the original proportions and quality??