ggmetanet {metanetwork} | R Documentation |
ggmetanet
Description
Function that provides network static representation (using 'ggnet') from a 'metanetwork' object using 'TL-tsne' or 'group-TL-tsne' layout.
Usage
ggmetanet(
metanetwork,
g = NULL,
beta = 0.1,
legend = NULL,
mode = "TL-tsne",
edge_thrs = NULL,
layout_metaweb = FALSE,
nrep_ly = 1,
flip_coords = FALSE,
diff_plot_bool = FALSE,
alpha_per_group = NULL,
alpha_per_node = NULL,
alpha_interactive = FALSE,
ggnet.config = ggnet.default,
TL_tsne.config = TL_tsne.default
)
Arguments
metanetwork |
object of class metanetwork |
g |
network (igraph object) to represent, default is metaweb |
beta |
the diffusion parameter of the diffusion kernel, a positive scalar controlling the vertical squeezing of the network |
legend |
resolution for the legend, legend resolution must be a coarser resolution than the resolution of g, default is NULL |
mode |
mode used for layout, 'TL-tsne' or 'group-TL-tsne' Default is 'TL-tsne'. This argument can also be a two-column matrix for custom layout. |
edge_thrs |
if non-null, a numeric (between 0 and 1) indicating an edge threshold for the representation |
layout_metaweb |
a boolean indicating whether the layout of the metaweb should be used to represent the network
to use metaweb layout = TRUE, you need first to compute metaweb layout for this beta value using |
nrep_ly |
If several layouts for this beta value are attached to the metaweb (if |
flip_coords |
a boolean indicating whether coordinates should be flipped. |
diff_plot_bool |
boolean, do not edit by hand |
alpha_per_group |
controlling alpha per group (only for 'ggnet' vis), a list of format
|
alpha_per_node |
controlling alpha per node (only for 'ggnet' vis), a list of format
|
alpha_interactive |
a boolean indicating whether alpha (that is node transparency) should be asked in interactive mode to the user |
ggnet.config |
configuration list for ggnet representation, default is ggnet.default |
TL_tsne.config |
configuration list for mode 'TL-tsne', default is TL_tsne.default |
Details
At each call of the function with 'TL-tsne' layout, it computes a layout for the current beta value. If a layout is already attached to the current network, it uses directly this layout (without computing). This function provides many static visualisation tools:
customising ggnet parameters wrapped in
ggnet.config
legending using the trophicTable
playing on group transparency (alpha)
using the metaweb layout
building a legend for large networks.
Value
an object of class ggplot
, the current network representation
See Also
Examples
library(metanetwork)
library(igraph)
#lattice example
g = make_lattice(dim = 2,length = 4,directed = TRUE)
#building metanetwork and computing trophic levels
meta0 = build_metanet(g)
meta0 = compute_TL(meta0)
ggmetanet(meta0)
#storing layout
meta0 = attach_layout(meta0)
ggmetanet(meta0)
#custom ggnet parameters
ggnet.custom = ggnet.default
ggnet.custom$label = TRUE
ggnet.custom$edge.alpha = 0.5
ggnet.custom$alpha = 0.7
ggnet.custom$arrow.size = 1
ggnet.custom$max_size = 12
# using pre-computed layout and custom ggnet parametersfor vertebrates metaweb
data("meta_vrtb")
#custom ggnet parameters
ggnet.custom = ggnet.default
ggnet.custom$label = TRUE
ggnet.custom$edge.alpha = 0.5
ggnet.custom$alpha = 0.7
ggnet.custom$arrow.size = 1
ggnet.custom$max_size = 12
#at SBM group level
beta = 0.005
ggmetanet(meta_vrtb,g = meta_vrtb$metaweb_group,flip_coords = TRUE,
beta = beta,legend = "group",
ggnet.config = ggnet.custom,edge_thrs = 0.1)