【发布时间】:2016-10-19 02:07:14
【问题描述】:
我正在尝试使用 R 和 igraph 绘制图形,使用顶点的形状和光栅图像的混合。我修改了下面的 igraph 示例以重现我的问题。有人能看出什么问题吗?您需要一个 png 文件来测试脚本。
library(png)
library(igraph)
img.1 <- readPNG(system.file("img", "Rlogo.png", package="png"))
shapes <- setdiff(shapes(), "")
g <- make_ring(length(shapes))
V(g)$shape <- shapes
#change the rectangle variants to raster
V(g)$shape[grepl("rect",V(g)$shape)] <- "raster"
#give every vertex the same image, regardless of shape
V(g)$raster <- replicate(vcount(g), img.1, simplify=FALSE)
plot(g,
vertex.size=15, vertex.size2=15,
vertex.pie=lapply(shapes, function(x) if (x=="pie") 2:6 else 0),
vertex.pie.color=list(heat.colors(5)))
【问题讨论】: