请看下面的例子扭曲:图像使用它时,作为IGRAPH节点
library(png)
library(igraph)
nodes=5
mat = matrix(runif(n = nodes*nodes,min = 0,max = 10),nodes,nodes)
mat.graph <- graph.adjacency(mat,weighted=TRUE,mode="undirected",diag=FALSE)
imgfilename <- file.path(tempdir(), "img.png")
imgfile <- download.file("https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Circle-icons-water.svg/2000px-Circle-icons-water.svg.png",
destfile=imgfilename,mode='wb')
img <- readPNG(imgfilename)
V(mat.graph)$raster <- list(img,img,img,img,img)
plot(mat.graph ,vertex.size=E(mat.graph)$weight,edge.width=E(mat.graph)$weight,
layout=layout.circle,vertex.shape="raster",vertex.label=NA,vertex.size=30, vertex.size2=30)
我的问题是,绘制时被用作节点中的图象被扭曲。是否可以保持宽度/长度比率是固定的?
此外,我看到节点的位置每次都随着权值的变化而不断变化。是否有可能让节点也处于固定位置?
非常感谢您提前。
顺便说一句,如何组合与其他节点的形状的光栅图像对象? – pengchy