When the shape of all vertices is set to "square" and the size of the vertices 
is also set, one get following error (commands attached):

Error in l[[which.min(sapply(l, function(p) (p[1] - x0)^2 + (p[2] - y0)^2))]] :
        attempt to select less than one element

Is there a way to solve this problem?

Robbie

## Load the igraph package
library(igraph)

## Create and plot a small graph
g <- graph( c(0,1, 0,2, 1,2, 2,3), n=4, directed = FALSE)
plot(g)

V(g)$size<-c(10,15,20,30)
plot(g) #OK

V(g)$shape<-c("circle","circle","circle","square")
plot(g) #OK

V(g)$shape<-c("circle","circle","square","square")
plot(g) #OK

V(g)$shape<-c("circle","square","square","square")
plot(g) #OK

V(g)$shape<-c("square","square","square","square")
plot(g) #Error in l[[which.min(sapply(l, function(p) (p[1] - x0)^2 + (p[2] - 
y0)^2))]] :
        #attempt to select less than one element

V(g)$shape<-c("square","square","circle","square")
plot(g) #OK

## Same without changing size
g <- graph( c(0,1, 0,2, 1,2, 2,3), n=4, directed = FALSE)
V(g)$shape<-c("square","square","square","square")
plot(g) #OK

______________________________________________
R-help@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.

Reply via email to