請看下面的例子扭曲:圖像使用它時,作爲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