ノードに画像を描画
## image
rasters <- c();
for(v in V(g)$name){
jpg <- paste("/Users/ukonlly/data/", v, ".jpg", sep="");
url <- paste("file://", jpg, sep="");
if(file.exists(jpg)){
con <- url(url, open="rb")
bin <- readBin(con, what="raw", n=10^6)
close(con)
rast <- readJPEG(bin, native=TRUE);
} else {
rast <- as.raster(matrix());
}
rasters <- c(rasters, list(rast));
}
V(g)$raster <- rasters;
## plot
plot(g, vertex.shape="raster",
layout=layout.auto,
margin=.2,
edge.label.family="Hiragino Kaku Gothic Pro W3",
vertex.label.family="Hiragino Kaku Gothic Pro W3",
vertex.size=8, vertex.size2=8,
vertex.label.dist=2, vertex.label.degree=0,
);
参考
R : Display Image at Exact Node in Igraph - Stack Overflow
Facebook data collection and photo network visualization with Gephi and R
Facebook data collection and photo network visualization with Gephi and R