[R-sig-eco] demographic matrix graphs: ugly but a start

Ben Bolker bbolker at gmail.com
Sat Oct 30 17:57:54 CEST 2010


library(Rgraphviz)
X <- matrix(c(0, 0.1, 1.5,
              1,   0, 0,
              0,   0.4, 0.2),
            byrow=TRUE,
            nrow=3)
dimnames(X) <- list(c("J","A1","A2"),c("J","A1","A2"))
X

Xg <- as(t(X),"graphNEL")
plot(Xg,recipEdges="distinct")


ew <- as.character(unlist(edgeWeights(Xg)))
ew <- ew[setdiff(seq(along = ew), removedEdges(Xg))]
names(ew) <- edgeNames(Xg)
eAttrs <- list(label=ew)
plot(Xg, edgeAttrs = eAttrs, recipEdges="distinct")



More information about the R-sig-ecology mailing list