From: Gabor Grothendieck <ggrothendieck_at_gmail.com>

Date: Thu 06 Jul 2006 - 11:33:20 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 06 11:36:02 2006

Date: Thu 06 Jul 2006 - 11:33:20 EST

Try this:

eAttrs <- list(color = c("A~B" = "green", "B~C" = "green", "C~D" = "yellow",

"A~C" = "yellow"))

plot(G, "neato", nodeAttrs = nAttrs, edgeAttrs = eAttrs)

More info via:

vignette("Rgraphviz")

On 7/5/06, Søren Højsgaard <Soren.Hojsgaard@agrsci.dk> wrote:

> Using Rgraphviz, I draw the undirected graph with vertices A,B,C and D and edges A:B, B:C, C:D, D:A, A:C. I want the vertices A and B to be red and C and D to be blue. The problem is the following: I want the edges A:B and B:C to be green and the edges C:D and C:A to be yellow, while the edge A:C can have the default colour black. I assume that I have to specify this using the edgeAttrs-argument in the plot function, but I can't figure out how. Can anyone help?

*> Thanks.
**> Søren
**>
**> Code for drawing the graph:
**>
**> library(Rgraphviz)
**> 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
**> plot(G, "neato",nodeAttrs=nAttrs)
**>
**> ______________________________________________
**> R-help@stat.math.ethz.ch mailing list
**> https://stat.ethz.ch/mailman/listinfo/r-help
**> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
**>
*

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 06 11:36:02 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 06 Jul 2006 - 12:20:15 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*