Note that there are some explanatory texts on larger screens.

plurals
  1. POspacing vertices evenly in igraph in r
    primarykey
    data
    text
    <p>I have the following graph graph</p> <pre><code>set.seed(1410) df&lt;-data.frame( "site.x"=c(rep("a",3),rep("b",3),rep("c",3),rep("d",3)), "site.y"=c(rep(c("e","f","g"),4)), "bond.strength"=sample(1:100,12, replace=TRUE)) library(igraph) df&lt;-graph.data.frame(df) V(df)$names &lt;- c("a","b","c","d","e","f","g") layOUT&lt;-data.frame(x=c(rep(1,4),rep(2,3)),y=c(4:1,3:1)) E(df)[ bond.strength &lt; 101 ]$color &lt;- "red" E(df)[ bond.strength &lt; 67 ]$color &lt;- "yellow" E(df)[ bond.strength &lt; 34 ]$color &lt;- "green" V(df)$color &lt;- "white" l&lt;-as.matrix(layOUT) plot(df,layout=l,vertex.size=10,vertex.label=V(df)$names, edge.arrow.size=0.01,vertex.label.color = "black") </code></pre> <p><img src="https://i.stack.imgur.com/NWmkh.png" alt="enter image description here"></p> <p>I would like to space the vertices "g-e" evenly along the vertical distance between vertex a and d to make my current graph (see below) prettier. As you can see it is pretty crowded. </p> <p><img src="https://i.stack.imgur.com/7nw2d.png" alt="enter image description here"></p> <p>Also I would like to move the two column of vertices closer together on the x-axis but I have noticed that adjusting the x coordinates in the layout is not responding. For example the two following layouts produce graph that look exactly the same despite the drastic adjustment in the x-coordinates. </p> <pre><code>layOUT&lt;-data.frame(x=c(rep(1,4),rep(2,3)),y=c(4:1,3:1)) layOUT&lt;-data.frame(x=c(rep(1,4),rep(100,3)),y=c(4:1,3:1)) </code></pre> <p>Thanks for any advice you may have.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload