[R] Rgraphviz: Setting the edge width

Søren Højsgaard Soren.Hojsgaard at agrsci.dk
Fri Jul 7 01:42:35 CEST 2006


I create an undirected graph with Rgraphviz (see code below). I would like to make the edges thicker. Can anyone help on this??
Regards
Søren
 
 
   V <- c("A","B","C","D")
   E <- list(c("A","B"),c("B","C"),c("C","D"),c("D","A"),c("A","C"))
   Eidx <- lapply(E, match, V)
   edL <- vector("list", length=length(V))
   names(edL) <- V
   for (i in 1:length(Eidx)){
     tmp <- Eidx[[i]]
     print(tmp)
     edL[[tmp[1]]]$edges <- c(edL[[tmp[1]]]$edges, tmp[2])
     edL[[tmp[2]]]$edges <- c(edL[[tmp[2]]]$edges, tmp[1])
   }
   G <- new("graphNEL", nodes=V, edgeL=edL)
   nAttrs <- list()
   nAttrs$fillcolor <- c("red","red","blue","blue")
   names(nAttrs$fillcolor) <- V 
   eAttrs <- list(color = c("A~B" = "green", "B~C" = "green", "C~D" = "yellow",
      "A~C" = "yellow"))
   plot(G, "neato", nodeAttrs = nAttrs, edgeAttrs = eAttrs)



More information about the R-help mailing list