r - Arrange multiple (32) .png files in a grid -
i've been pulling hair out past week trying figure out elementary r coding can't seem anywhere (haven't used r since 2013 not great excuse).
all want 4x8 grid made of 32 .png files (maps i've made), , want without loading 1 image file @ time (http://www.statmethods.net/advgraphs/layout.html).
so think can load images within folder writing (please correct me if beliefs bs)
img <- list.files(path='c:/a',patt='compo[0-32].*',full.names=t)
then thinking maybe in lines of par(mfrow=c())
, layout
, grid.arrange
(writing png plots pdf file in r), grid.raster
(how join efficiently multiple rgl plots 1 single plot?) - i've read on , experimented accordingly not resulting in worthwhile..
the latter employed following outcome
it made me giggle. don't think lattice
way go anyway.
any appreciated!
not sure concern loading image files -- how else read data create new image?
eta: load files, i'd use png::readpng
. 1 way collect images be(12 images selected here)
filenames<-dir(pattern='compo') foo<-list() for(j in 1:12) foo[[j]]<-readpng(filenames[j]
if you're willing load them , use base plot
tools, layout
command want. e.g., 12 images loaded
layout(matrix(1:12,nr=4,byr=t)) (j in 1:12) plot(foo[[j]])
Comments
Post a Comment