diff --git a/R/fortify-igraph.R b/R/fortify-igraph.R index d731582..c8b1176 100644 --- a/R/fortify-igraph.R +++ b/R/fortify-igraph.R @@ -24,10 +24,11 @@ fortify.igraph <- function( ... ) { # node placement - if (inherits(layout, "matrix") && identical(dim(layout), c(igraph::gorder(model), 2L))) { - nodes <- layout[, 1:2 ] - } else if (inherits(layout, "matrix")) { - stop("layout matrix dimensions do not match network size") + if (inherits(layout, "matrix")) { + if (nrow(layout) != igraph::gorder(model)) { + stop("layout matrix dimensions do not match network size") + } + nodes <- layout[, 1:2] } else { nodes <- igraph::layout_(model, layout, ...) }