GoogleSearch
이 블로그 검색
igaph
라벨:
Informatics
이메일로 전송BlogThis!X에 공유Facebook에서 공유
# Need more space between vertices or edges?
library( igraph )
g = barabasi.game(355, directed=FALSE)
png("plot1.png", height=6, width=12, units="in", res=200)
par(mfrow=c(1, 2))
plot.igraph(g,vertex.size=3,vertex.label=NA, layout=layout.fruchterman.reingold(g, niter=10000))
mtext("layout.fruchterman.reingold, area = vcount^2", side=1)
l = layout.fruchterman.reingold(g,niter=500,area=vcount(g)^2.3,repulserad=vcount(g)^2.8)
plot.igraph(g,vertex.size=3,vertex.label=NA,layout=l )
mtext("layout.fruchterman.reingold, area = 30 * vcount^2", side=1)
dev.off()
plot(g, layout=l, vertex.label.cex=label.cex, vertex.label.dist=label.dist, vertex.size=V(g)$size, vertex.label=node.label, edge.arrow.size=0.3, vertex.label.color="black", edge.width=E(g)$width, edge.color=E(g)$color, edge.lty=1)
# I added vertex.frame.color function here.
#################################################################
library( igraph )
# triangle vertex shape
mytriangle <- function(coords, v=NULL, params) {
vertex.frame.color <- params( "vertex", "frame.color")
vertex.color <- params("vertex", "color")
if (length(vertex.color) != 1 && !is.null(v)) {
vertex.color <- vertex.color[v]
vertex.frame.color <- vertex.frame.color[v]
}
vertex.size <- 1/200 * params("vertex", "size")
if (length(vertex.size) != 1 && !is.null(v)) {
vertex.size <- vertex.size[v]
}
symbols(x=coords[,1], y=coords[,2], fg=vertex.frame.color, bg=vertex.color,
stars=cbind(vertex.size, vertex.size, vertex.size),
add=TRUE, inches=FALSE)
}
add.vertex.shape("triangle", clip=vertex.shapes("circle")$clip, plot=mytriangle)
mystar <- function(coords, v=NULL, params) {
vertex.color <- params("vertex", "color")
vertex.frame.color <- params( "vertex", "frame.color")
if (length(vertex.color) != 1 && !is.null(v)) {
vertex.color <- vertex.color[v]
vertex.frame.color <- vertex.frame.color[v]
}
vertex.size <- 1/200 * params("vertex", "size")
if (length(vertex.size) != 1 && !is.null(v)) {
vertex.size <- vertex.size[v]
}
norays <- params("vertex", "norays")
if (length(norays) != 1 && !is.null(v)) {
norays <- norays[v]
}
mapply(coords[,1], coords[,2], vertex.color, vertex.frame.color, vertex.size, norays,
FUN=function(x, y, bg, fg, size, nor) {
symbols(x=x, y=y, bg=bg, fg=fg,
stars=matrix(c(size,size/2), nrow=1, ncol=nor*2),
add=TRUE, inches=FALSE)
} )
}
add.vertex.shape("star", clip=igraph.shape.noclip, plot=mystar, parameters=list(vertex.norays=5))
이메일로 전송BlogThis!X에 공유Facebook에서 공유
라벨:
Informatics
Scientist. Husband. Daddy. --- TOLLE. LEGE
외부자료의 인용에 있어 대한민국 저작권법(28조)과 U.S. Copyright Act (17 USC. §107)에 정의된 "저작권물의 공정한 이용원칙 | the U.S. fair use doctrine" 을 따릅니다. 저작권(© 최광민)이 명시된 모든 글과 번역문들에 대해 (1) 복제-배포, (2) 임의수정 및 자의적 본문 발췌, (3) 무단배포를 위한 화면캡처를 금하며, (4) 인용 시 URL 주소 만을 사용할 수 있습니다. [후원 | 운영] [대문으로] [방명록] [옛 방명록] [티스토리 (백업)] [신시내티]
-