iam very new to R and having difficulties to add several images to my plot. Adding a single picture works perfectly fine by using the following code:
`add_image_centre <- function(plot_path, image_path) {
fig <- image_read(plot_path)
fig <- image_resize(fig, "1000x1000")
img <- image_read(image_path)
img <- image_scale(img, "62x85")
image_composite(fig, img, offset = "+387+442")
}
imagepl <- add_image_centre(plot_path = ".png", image_path = ".png")
imagepl
image_write(imagepl, ".png")
`
How can i add several images this way?
I have tried copying the code but then it just changes to the last picture added and removes the first one.
1条答案
按热度按时间k7fdbhmy1#
简单地说
可以按如下方式并排合并
fig
和img
:参考
请参阅https://rdrr.io/cran/magick/f/vignettes/intro.Rmd处的
Combining
部分,也如下所示: