plotSbm {shinySbm}R Documentation

plotSbm

Description

A fct that plot a beautiful matrix from an sbm object or a network matrix it does have suitable parameters to get the wanted plots. This is the generic function: it does have one method Bipartite and one for Simple Sbm. The 'x' object need to be construct by one of the 'estimate***SBM' function from the 'sbm' package.

Usage

plotSbm(
  x,
  ordered = FALSE,
  transpose = FALSE,
  labels = NULL,
  plotOptions = list()
)

Arguments

x

Sbm model of class 'BipartiteSBM_fit', 'SimpleSBM_fit' or simple numeric 'matrix'.

ordered

Boolean. Set TRUE if the matrix should be reordered (Default is FALSE)

transpose

Boolean. Set TRUE to invert columns and rows to flatten a long matrix (Default is FALSE)

labels

a named list (names should be: '"col"' and '"row"') of characters describing columns and rows component (Default is NULL)

plotOptions

a list providing options. See details below.

Details

The list of parameters plotOptions for the matrix plot is

Value

a ggplot object corresponding to the matrix plot inside the app. Groups the network matrix is organized by blocks, the small tiles are for individuals connections. The big tiles between red lines are for block connectivity

Examples



# my_sbm_bi <- sbm::estimateBipartiteSBM(sbm::fungusTreeNetwork$fungus_tree,
#                                        model = 'bernoulli')
my_sbm_bi <- FungusTreeNetwork$sbmResults$fungus_tree

plotSbm(my_sbm_bi,
  ordered = TRUE, transpose = TRUE,
  plotOptions = list(title = "An example Matrix")
)


# my_sbm_uni <- sbm::estimateSimpleSBM(sbm::fungusTreeNetwork$tree_tree,
#                                      model = "poisson")
my_sbm_uni <- FungusTreeNetwork$sbmResults$tree_tree

plotSbm(my_sbm_uni,
  ordered = TRUE,
  plotOptions = list(title = "An example Matrix")
)

n_col <- 100
n_row <- 90
mat <- matrix(sample(0:10, n_col * n_row, replace = TRUE), n_col, n_row)
plotSbm(mat,
  transpose = TRUE,
  labels = list(col = "Columns", row = "Rows"),
  plotOptions = list(colValue = "blue")
)


[Package shinySbm version 0.1.5 Index]