On Wed, Apr 8, 2009 at 10:20 PM, jpearl01 <joshea...@hotmail.com> wrote: > > That's like a miracle! The only thing that would make this graph perfect is > if the lengths of the edges were in the same ratio as the actual edge > lengths from the matrix. Is it possible to alter that?
Not really. The thing is that the nodes are ordered into layers based on the distance (in steps) from the root. This is how the Reingold-Tilford layouting algorithm works. If you start changing the lengths of the edges, then the nodes could move on top of each other. You would need to modify the algorithm itself for this, I don't know how difficult that would be. What you can do is modifying the width of the edges, I know that is not as good, but it is still something: library(igraph) tab <- read.csv("http://www.nabble.com/file/p22957493/sp_matrix.csv") tab <- tab[,-1] g <- graph.adjacency(as.matrix(tab), weighted=TRUE) V(g)$label <- V(g)$name mst <- minimum.spanning.tree(g) rescale <- function(x,from,to) { # linearly rescale a vector r <- range(x) (x-r[1]) / (r[2]-r[1]) * (to-from) + from } E(mst)$width <- rescale(E(mst)$weight,1,5) # width between 1 and 5 lay <- layout.reingold.tilford(mst, root=which.max(degree(mst))-1) lay <- cbind(lay[,2], lay[,1]) # rotate x11(width=15, height=8) plot(mst, layout=lay, vertex.size=25, vertex.size2=10, vertex.shape="crectangle", asp=FALSE, vertex.label.cex=0.7, vertex.color="white", edge.arrow.mode=0) G. > Thank you!! > ~josh > [...] -- Gabor Csardi <gabor.csa...@unil.ch> UNIL DGM ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.