How to fix nodes when plotting a subset over a complete network using igraph R

前端 未结 1 2040
隐瞒了意图╮
隐瞒了意图╮ 2020-12-21 01:56

I have a problem concerning network visualization using the igraph package provided in R.

Assume that you have a certain network, which contains the total sample of

相关标签:
1条回答
  • 2020-12-21 02:39

    The reason is that igraph plotting functions rescale the layout to [-1,1] x [-1,1] by default. You can use the rescale=FALSE argument to plot() and then no rescaling is performed.

    Note that in this case you'll need to set the limits of the plot by hand, by setting xlim and ylim:

    xlim <- range(lay[,1])
    ylim <- range(lay[,2])
    plot.igraph(inetX, layout = lay, vertex.size = 20, 
                xlim = xlim, ylim = ylim, rescale = FALSE)
    plot.igraph(inetY, layout = lay[idx,], vertex.size = 14, 
                add = TRUE, rescale = FALSE)
    

    enter image description here

    0 讨论(0)
提交回复
热议问题