I am trying to create something like this, but with different images for each node. PNG images as vertices in R (igraph)
I have tried using the same format but on a list of images, but I get this error:
Error in UseMethod("as.raster") :
no applicable method for 'as.raster' applied to an object of class "list"
img_train <- list.files(path = "~/Path/to/files", pattern = ".png")
img_list <- lapply(img_train, readPNG)
g <- graph.ring(5)
V(g)$raster <- replicate(vcount(g), img_list, simplify=FALSE)
plot(g, vertex.shape="raster", vertex.label=NA,
vertex.size=1:10*5, vertex.size2=1:10*5)
I am not sure how raster works - so any help would be greatly appreciated. Thank you!