|
From: | Ted Toal |
Subject: | [igraph] mycircle and arrows |
Date: | Thu, 29 Oct 2015 07:10:42 -0700 |
The example "mycircle" custom vertex with customizable thickness of borders, posted 15 Mar 2013, has a problem when edges are directed: the arrows are covered by the node circles. The arrow tip appears to end at the center of the circle. How might I fix this? Ted Toal library(igraph) mycircle <- function(coords, v=NULL, params) { vertex.color <- params("vertex", "color") if (length(vertex.color) != 1 && !is.null(v)) { vertex.color <- vertex.color[v] } vertex.size <- 1/200 * params("vertex", "size") if (length(vertex.size) != 1 && !is.null(v)) { vertex.size <- vertex.size[v] } vertex.frame.color <- params("vertex", "frame.color") if (length(vertex.frame.color) != 1 && !is.null(v)) { vertex.frame.color <- vertex.frame.color[v] } vertex.frame.width <- params("vertex", "frame.width") if (length(vertex.frame.width) != 1 && !is.null(v)) { vertex.frame.width <- vertex.frame.width[v] } mapply(coords[,1], coords[,2], vertex.color, vertex.frame.color, vertex.size, vertex.frame.width, FUN=function(x, y, bg, fg, size, lwd) { symbols(x=x, y=y, bg=bg, fg=fg, lwd=lwd, circles=size, add=TRUE, inches=FALSE) }) } add.vertex.shape("fcircle", clip=igraph.shape.noclip, plot=mycircle, parameters=list(vertex.frame.color=1, vertex.frame.width=1)) g=graph.formula(A-+B,B-+C) layout=matrix(c(2,1, 1,0, 3,0),byrow=TRUE,nrow=3) plot.igraph(g,layout=layout,edge.color="black",vertex.color="white", vertex.label=c("A","B","C"),vertex.size=20,vertex.label.cex=3, vertex.label.color="black",vertex.shape="fcircle", vertex.frame.color="black",edge.width=3,edge.arrow.size=1.2,edge.arrow.width=1.2) |
[Prev in Thread] | Current Thread | [Next in Thread] |