See ?plot.igraph, example:
plot(g, layout=mlayout,
vertex.label.color = "red",
vertex.color = "green",
vertex.frame.color = "blue",
edge.color = "orange",
edge.width = 1 + (1:18)/2
)
Uwe Ligges
On 06.06.2010 17:58, Etienne Cuvelier wrote:> Hello,
> I am using the igraph package, and I wonder how to add or modify
> informations on a drawn graph.
>
> Example:
> library(igraph)
> M <- matrix( nc=12, nr=12 , 0)
> M[ 1,]=c(0,1,0,0,1,1,0,0,0,0,0,0)
> M[ 2,]=c(1,0,1,1,1,0,0,0,0,0,0,0)
> M[ 3,]=c(0,1,0,0,0,1,1,0,0,0,0,0)
> M[ 4,]=c(0,1,0,0,0,1,0,0,0,0,0,0)
> M[ 5,]=c(1,1,0,0,0,0,0,0,0,0,0,0)
> M[ 6,]=c(1,0,1,1,0,0,0,0,0,0,0,0)
> M[ 7,]=c(0,0,1,0,0,0,0,1,1,0,0,1)
> M[ 8,]=c(0,0,0,0,0,0,1,0,1,0,0,1)
> M[ 9,]=c(0,0,0,0,0,0,1,1,0,0,1,1)
> M[10,]=c(0,0,0,0,0,0,0,0,0,0,1,0)
> M[11,]=c(0,0,0,0,0,0,1,0,1,0,0,0)
> M[12,]=c(0,0,0,0,0,0,0,1,1,0,0,0)
> g <- graph.adjacency( M,mode="undirected" )
> mlayout= layout.kamada.kawai(g)
> plot(g,layout=mlayout)
>
> #And now howto add a weight associated on edges on the "picture"?
> #Or howto change the color of an edge, or a vertice?
>
> Thanks for help.
>
>
> Etienne
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.