newlogo <- image_read("https://jeroen.github.io/images/Rlogo.png")
images=rep(newlogo,11)
chunk_images=split(images, ceiling(seq_along(images)/3))
annotated_images=lapply(images,function(x){
image_annotate(image_read("https://jeroen.github.io/images/Rlogo.png"), paste0('Random Number: ',rnorm(1)), color = 'white',boxcolor='grey10', size = 23)
})
list_of_rows=lapply(chunk_images,function(x){image_append(c(image_annotate(x, paste0('Random Number: ',rnorm(1)), color = 'white',boxcolor='grey10', size = 23)))})
#list_of_rows[1] == 3 images side-by-side
#list_of_rows[2] == 3 images side-by-side
#list_of_rows[3] == 3 images side-by-side
#list_of_rows[4] == the remaining 2 images
我想将
list_of_rows
堆放在彼此的顶部,这些都不起作用:
lapply(list_of_rows,function(x){image_append(x,stack=T)})
do.call(c,list_of_rows)
正在寻找一种灵活的方式,以安排我可以控制的列数中4-32张图像的任何位置(每次不知道图像的总数)。
在 @fmw42的评论中建议的,您可以使用函数
image_montage
和Tile参数控制列布置