[R] igraph and plotting connected components
Duncan Murdoch
murdoch at stats.uwo.ca
Tue Oct 9 02:44:32 CEST 2007
On 08/10/2007 8:27 PM, Dieter Best wrote:
> Hello there,
>
> I am using the igraph package to build graphs from my data. If I plot a graph though, it's not easy for me to see what's going on. Does anybody know how to rearrange a graph to get a plot without too many crossing lines? Maybe other packages?
Rgraphviz in Bioconductor does a great job of this. It's a wrapper for
the Graphviz library, so the R docs are a little sparse, but there's a
tremendous amount of flexibility there.
For example,
library(Rgraphviz)
nodes <- c("R", "Scheme", "S", "APL", "Lisp", "Fortran", "Ratfor",
"CLOS", "C", "Haskell")
edges <- list(R=character(0), Scheme=c("R","Haskell"), S="R", APL=c("S",
"Haskell"), Lisp=c("Scheme", "S", "CLOS","Haskell"),
Fortran="Ratfor", Ratfor="S", CLOS="S",
C=c("S","R","Ratfor"), Haskell="R")
g <- new("graphNEL", nodes=nodes, edgeL=edges, edgemode="directed")
plot(g)
Duncan Murdoch
More information about the R-help
mailing list