Skip to content

Commit

Permalink
Enhancement for Issue #233
Browse files Browse the repository at this point in the history
fix: added extra check for `shape.node` to avoid error and adjusted scaling of node size
  • Loading branch information
Max-Bladen committed Dec 13, 2022
1 parent 8fcd5b8 commit 1c4cfe7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/network.R
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,11 @@ network <- function(mat,
} else {
if(is.null(shape.node))
shape.node=c("circle", "rectangle")
if (length(shape.node)==1) {
if(shape.node=="none") {
shape.node=c("none", "none")
}
}

if (!is.list(shape.node))
{
Expand Down Expand Up @@ -1028,8 +1033,9 @@ network <- function(mat,
plot(1:upr.bnd, 1:upr.bnd, type = "n", axes = FALSE, xlab = "", ylab = "")
cha = V(gR)$label
cha = paste("", cha, "")
xh = strwidth(cha, cex = ifelse(size.node==0.5, cex0, size.node*4)) * 1.5
yh = strheight(cha, cex = cex0) * 3
xh = strwidth(cha, cex = ifelse(size.node==0.5, cex0, size.node*4)) * 1.5 * (2-graph.scale)
yh = strheight(cha, cex = ifelse(size.node==0.5, cex0, size.node*4)) * 3 * (2-graph.scale)


V(gR)$size = xh
V(gR)$size2 = yh
Expand Down

0 comments on commit 1c4cfe7

Please sign in to comment.