[R] function: ploting an igraph object within lattice

Andrewjohnclose a.j.close at ncl.ac.uk
Mon Oct 12 14:46:18 CEST 2009


Hi, I would like to be able to develop a function to plot an igraph object
with lattice (trellis type displays will be usefull for grouping etc).
Anyway, I mostly feeble 

Igraph requires that you convert two columns of data two an igraph object
and to be able to plot the graph...I have tried a very, very simplistic (if
not naive) approach and surprise, surprise, it didn't work.

First of all, does anyone know any good tutorial packages/books that will
help someone like me unused to programming develop their function writing
skills, and secondly, can anyone suggest a way to generate an igraph object
in lattice.

Thanks

Andrew

######generates the igraph plot
library(igraph)
LE<-read.csv("LE.csv")
LG<-graph.data.frame(LE, directed=F)
LG$layout<-layout.kamada.kawai(LG)
plot(LG, vertex.size=4, vertex.label=NA, vertex.color="red",
vertex.shape="square", edge.color="blue4")
######
######
library(lattice)
######
######
xyplot.igraph <- function(plot.igraph, ...) {
    
dat <- graph.data.frame(x = object, directed=FALSE)
prepanel=prepanel.igraph
    
}

prepanel.igraph <- function(x, axes=FALSE, xlab="", ylab="", add=FALSE,
      xlim=c(-1,1), ylim=c(-1,1), main="", sub="")



http://www.nabble.com/file/p25855220/LE.csv LE.csv 
-- 
View this message in context: http://www.nabble.com/function%3A-ploting-an-igraph-object-within-lattice-tp25855220p25855220.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list