Skip to content

Commit

Permalink
fixing some warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jchiquet committed Jan 30, 2024
1 parent a4f717b commit b8e6bd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 4 additions & 5 deletions R/utils_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,8 @@ plotMultipartiteMatrix = function(listMat, E, nbNodes, namesFG,namesLayers, dist
testRow <- vapply(1:(nbSep*nbFG),function(i){1*(G[separRow$FG_row_index[i],separRow$FG_col_index[i]]==1)},1)
separRow <- separRow[testRow==1,]


g <- g + geom_vline(data= separCol, aes(xintercept = .data$sepCol),size= currentOptions$line.width, col=currentOptions$line.color)
g <- g + geom_hline(data= separRow, aes(yintercept = .data$sepRow),size= currentOptions$line.width, col=currentOptions$line.color)
g <- g + geom_vline(data= separCol, aes(xintercept = .data$sepCol), linewidth = currentOptions$line.width, col=currentOptions$line.color)
g <- g + geom_hline(data= separRow, aes(yintercept = .data$sepRow), linewidth = currentOptions$line.width, col=currentOptions$line.color)
}

if (!is.null(currentOptions$title)){g <- g + ggtitle(currentOptions$title) }
Expand Down Expand Up @@ -485,14 +484,14 @@ plotMeso <- function(thetaMean, pi,model,directed,bipartite,nbNodes,nodeLabels,p
colnames(alpha.norm) <- paste(vertex.label$col,1:length(pi$col),sep='')
rownames(alpha.norm) <- paste(vertex.label$row,1:length(pi$row),sep='')
vlab <- c(rownames(alpha.norm),colnames(alpha.norm))
g <- igraph::graph_from_incidence_matrix(alpha.norm, weighted = TRUE)
g <- suppressWarnings(igraph::graph_from_incidence_matrix(alpha.norm, weighted = TRUE))
u <- c(pi$row*nbNodes[1],pi$col*nbNodes[2])
if (is.null(layout)){ layout <- igraph::layout_as_bipartite(g)}
}else{
vlab <- paste(vertex.label,1:length(pi),sep = "")
u <- pi*nbNodes[1]
mode <- ifelse(directed,'directed','undirected')
g <- igraph::graph.adjacency(alpha.norm, mode = mode, weighted = TRUE)
g <- suppressWarnings(igraph::graph.adjacency(alpha.norm, mode = mode, weighted = TRUE))
if (is.null(layout)){layout <- igraph::layout_with_fr(g)}
}

Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-MultipartiteSBM.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ test_that("initializing Multipartite SBM works", {
expect_lt(myMBM$ICL, myMBM$loglik)

# S3 methods
## expect_silent(plot(myMBM, type = "data"))
#
expect_silent(plot(myMBM, type = "data"))
expect_silent(plot(myMBM, type = "meso"))
## expect_silent(plot(myMBM, type = "expected"))
expect_silent(plot(myMBM, type = "expected"))
expect_equal(coef(myMBM, 'connectivity'), myMBM$connectParam)
expect_equal(coef(myMBM, 'block') , myMBM$blockProp)

Expand Down

0 comments on commit b8e6bd1

Please sign in to comment.