1
[R帮助]PNG图像作为顶点R(igraph)
你好,有没有什么办法可以使用png图像作为R中的顶点?具体而言,仍然使用igraph软件包?
例如,我有一些PNG图像 1.png 2.png 3.png
我可以替换1.png一定的顶点,与他人2.png,并与3.png休息?
[R帮助]PNG图像作为顶点R(igraph)
你好,有没有什么办法可以使用png图像作为R中的顶点?具体而言,仍然使用igraph软件包?
例如,我有一些PNG图像 1.png 2.png 3.png
我可以替换1.png一定的顶点,与他人2.png,并与3.png休息?
这是新raster
顶点形状简单:
library(png)
library(igraph)
# To get an image to plot
imgfilename <- file.path(tempdir(), "igraph2.png")
imgfile <- download.file("http://igraph.sourceforge.net/images/igraph2.png",
destfile=imgfilename)
img <- readPNG(imgfilename)
g <- graph.ring(10)
# This is a complex attribute, so supply a list here
V(g)$raster <- replicate(vcount(g), img, simplify=FALSE)
plot(g, vertex.shape="raster", vertex.label=NA,
vertex.size=1:10*5, vertex.size2=1:10*5)
其实还有一个更简单的方法,请参阅我的答案。 –