to以魔法读取和带注释的图像以网格般的方式设置图像。我可以在3(即3列)的组中读取,注释,并在3列中读取图像。我只是不知道如何将这些组堆在一起。 这是所需的结果,但不是灵活的(?),image_ggplot()痛苦慢:

问题描述 投票:0回答:1
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参数控制列布置

r magick
1个回答
0
投票


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.