The 'name' attribute is not used for vertex labels by default. If you
want to use it, you need to set it as the 'label' attribute as well,
or supply them in the function call:
tkplot(graph, vertex.label=V(graph)$name)
Best,
Gabor
On Wed, Sep 14, 2011 at 7:11 PM, karena <dr.jzhou at gmail.com>
wrote:> Hi,
>
> I am using 'igraph' to make some plots. The problem I got is that I
don't
> know how to label the nodes with gene names.
>
> My sample code:
>
> ## suppose I have 100 gene (nodes) ##
> ---------------------------------------------------------------------------
> graph <- set.vertex.attribute(graph, "color",
> value=c(rep(c('green','red'),50)))
> graph <- set.vertex.attribute(graph, "name", value=genelist)
> tkplot(graph)
>
----------------------------------------------------------------------------
> The 'color' attribute does work, the nodes are red and green, but
the 'name'
> attribute doesn't work, I still have the numeric id on each node
(0-99).
>
> Can anyone tell me how to solve this problem?
>
> Thank you,
>
> Karena
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Questons-about-igraph-package-tp3814338p3814338.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
--
Gabor Csardi <csardi at rmki.kfki.hu>? ?? MTA KFKI RMKI