Here is a dirty solution using the netdiffuseR package. In particular, I
use the function edges_coords which computes edges coordinates considering
device size and vertices size in terms of the x axis... is not as flexible
as igraph.plotting, but it solves your issue... Will work on a better
solution for the future!

rm(list =ls())
library(netdiffuseR)
library(igraph)

nodes <- c('a','b','c','d','e','f')
x <- c(1540, 1545, 1540,1580,1600,1650)
y <- c(52, 53, 55,56,54,58)
from <- c('a','a','a','a','e','d')
to <- c('b','c','d','e','f','f')
Nodelist <- data.frame(nodes, x ,y)
Edgelist <- data.frame(from, to)
a <- graph_from_data_frame(vertices = Nodelist, d= Edgelist, directed =
TRUE)

# Getting edge coordinates
vcex <- runif(nnodes(as_adj(a)), 1, 4)
ecoords <- edges_coords(
  as_adj(a),
  rep(10L, nnodes(as_adj(a))),
  x = x, y = y,
  vertex_cex = vcex,
  dev = par("pin"), no_contemporary = FALSE,
  undirected = FALSE
)

ecoords <- as.data.frame(ecoords)

# Plotting
symbols(x, y, circles=vcex,
        inches=FALSE, xaxs="i", yaxs="i")

with(ecoords, arrows(x0,y0,x1,y1, length=.1))

Best,

George G. Vega Yon
+1 (626) 381 8171 <(626)%20381-8171>
http://cana.usc.edu/vegayon

On Thu, Feb 16, 2017 at 12:22 PM, Leroi, Armand M <[email protected]>
wrote:

> Hello,
>
> I am using a fixed layout.  Under some circumstances, the behaviour of
> the edges appears to interact with vertex.size in an unfortunate way
>
> Below is an example.  Here, the default vertex size (15?) gives almost
> invisible vertices.  But the edges and arrow heads all line up nicely.  So,
> I increase the vertex.size = 300. Now they’re visible, however, some of
> the edges no longer run from vertex-to-vertex. They’re misplaced and
> pointing in the wrong direction.  This phenomenon seems to affect
> y-axis-stacked nodes most acutely.  Can anyone suggest a fix?  Below is a
> MWE.  Play around with vertex.size and you should see what I mean.
>
> With thanks
>
> Armand
>
>
>
>
>
>
> nodes <- c('a','b','c','d','e','f')
> x <- c(1540, 1540, 1540,1580,1600,1650)
> y <- c(52, 53, 55,56,54,58)
> from <- c('a','a','a','a','e','d')
> to <- c('b','c','d','e','f','f')
> Nodelist <- data.frame(nodes, x ,y)
> Edgelist <- data.frame(from, to)
> a<- graph_from_data_frame(vertices = Nodelist, d= Edgelist, directed =
> TRUE)
> plot(a, ylim=c(52,58), xlim=c(1530,1650), asp=0, rescale=FALSE, axes=TRUE,
> vertex.size=400)
>
>
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to