[R] plot.igraph

Gábor Csárdi csardi at rmki.kfki.hu
Thu Sep 29 17:42:59 CEST 2011


Dear Steven,

you have two options, one is to make the multiple edges thicker, see
the 'edge.width' argument for that.

The other is to make multiple edges curve a bit, see the 'edge.curved'
argument.
Both of these are documented at ?igraph.plotting. You can use
count.multiple() to find the edges that are multiple.
There are some examples for curved edges here:
https://lists.nongnu.org/archive/html/igraph-help/2009-03/msg00170.html

Best,
Gabor

On Thu, Sep 29, 2011 at 9:19 AM, Steven Wolf <wolfste4 at msu.edu> wrote:
> I am having trouble plotting one of my graphs (think graph theory graph with
> edges and vertices, not scatterplots or histograms).  For some pairs of
> vertices, I want multiple edges to be visible in my graph.  As an example of
> this, in my script below, I want two edges to be visible from vertex 1 and
> vertex 9 (among some others) yet when I plot it, only one edge is visible.
>
> ################################################################
> gp1 = c(1,3,5,7,9)
> gp2 = c(2,4,6,8,10)
> gp3 = c(2,3,5,7)
> gp4 = c(1,4,9)
>
> adjm = numeric(100)
> dim(adjm) = c(10,10)
>
> for (i in 1:4){
>        gp = eval(as.symbol(paste("gp",i,sep="")))
>        N = length(gp)
>        for (j in 1:N){
>                for (k in j:N){
>                        adjm[gp[k],gp[j]] = adjm[gp[k],gp[j]]+1
>                        adjm[gp[j],gp[k]] = adjm[gp[k],gp[j]]
>                }
>        }
> }
> for(i in 1:10){adjm[i,i]=0}
> require(igraph)
> gg=graph.adjacency(adjm,mode="max")
>
> V(gg)$name = 1:10
> V(gg)$label = V(gg)$name
>
> plot.igraph(gg, layout=layout.kamada.kawai, vertex.color=gray(0.7))
>
> #################################################################
>
> Thanks in advance,
> -Steven Wolf
> MSU Dept of Physics
>
> ______________________________________________
> 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



More information about the R-help mailing list