[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] subgraph and plot
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] subgraph and plot |
Date: |
Mon, 6 Apr 2009 23:18:48 +0200 |
Simone,
sorry, I cannot easily reproduce your example, because I don't have
the graph to work with. (It is a good idea to send self-contained
code.) Check what is in your 'l4' and 'll' variables before the
plotting. I guess that 'l4' is not a matrix and you might be the next
victim of the famous 'drop the dim' R trap. In this case the fix is:
l4 <- ll[ corenumber+1, ,drop=FALSE ]
On Sun, Apr 5, 2009 at 11:42 AM, simone gabbriellini
<address@hidden> wrote:
[...]
> for (i in 1:length(core)){
> corenumber[i]<-V(g)[label==core[i]]
> }
[...]
> g4 <- subgraph(g, corenumber)
> g4 <- delete.edges(g4, E(g4))
> l4 <- ll[ corenumber+1, ]
> plot(g4, layout=l4, vertex.size=5, vertex.label=NA,
> vertex.color=NA, vertex.frame.color="blue", add=TRUE, rescale=FALSE)
>
> and it works perfect untill the "core" variable contains at least two
> names... if it happens to be only one name, then I am able to subgraph, to
> find the layout coordinates of that single node, but when I try to plot I
> get this error from layout:
>
> Error in layout[, 1] : wrong number of dimensions
Oh, yeah, this is the trap I mentioned. See the fix above. You should
use 'drop=FALSE' for _EVERY_ indexing if you want to be use that the
result is still a matrix.
Best,
Gabor
> can someone help me?
> thanks,
> simone
>
>
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
--
Gabor Csardi <address@hidden> UNIL DGM