Styles the links between layers: whether they are drawn (show; MiRA
hides them by default), their color, a weight filter, how much they
curve, and between which layers they are shown (pairs). Add it to a
plot made with mira().
Usage
mira_interlayer(
show,
color_by,
color,
min_weight,
curvature,
pairs,
color_values,
color_scale,
color_palette,
color_reverse,
color_limits
)Arguments
- show
TRUEorFALSE: draw interlayer links.- color_by
Link column to color interlayer links by.
NULLorNA= default.- color
A constant link color: a color name or
"#rrggbb". Givecolor_byorcolor, not both.- min_weight
Hide links with weight below this value (0 or more, in the units of the data's
weightcolumn).- curvature
Curvature of interlayer links, between 0 (straight) and 1 (0.35 = MiRA's default).
- pairs
Show only the interlayer links between these pairs of layers:
list(c("L1", "L2"), c("L2", "L3")), bylayer_name; one pair may be given as a vector,c("L1", "L2"). The order within a pair does not matter. Also turns interlayer links on, unless the same call givesshow = FALSE. A pair of layers with no links between them draws nothing. A laterpairsreplaces an earlier one; there is no value that shows all pairs again.- color_values
Colors for values of the
color_bycolumn, named by value. See mira_scales.- color_scale
"categorical"or"continuous". See mira_scales.- color_palette
A named palette for the
color_byscale: categorical ("Okabe-Ito", ...) or continuous ("magma", ...); see mira_scales for the list.- color_reverse
TRUEreverses the palette.- color_limits
c(min, max): the gradient runs frommintomaxinstead of the data's range; values outside take the end colors. Gives a continuous scale.
Details
Interlayer links are drawn only with show = TRUE or pairs: the other
arguments alone style links that stay hidden (a color_by still shows
its legend).
See also
mira_intralayer() for the links within layers;
mira_scales for color_values and color_scale.
Other components:
mira_camera(),
mira_filter(),
mira_intralayer(),
mira_layer(),
mira_layout(),
mira_legends(),
mira_mode,
mira_mode_dashboard(),
mira_mode_data(),
mira_mode_grid(),
mira_mode_layer(),
mira_mode_map(),
mira_mode_meta(),
mira_node()
Examples
library(emln)
net <- load_emln(17) # 4 layers; bird and plant nodes
#> Creating state node map
#> Creating extended link list with node IDs
p <- mira(net, bipartite = TRUE, setA_type = "bird")
#> Bipartite network: drawn as undirected. Use directed = TRUE for a directed one.
# Show interlayer links (hidden by default)
p + mira_interlayer(show = TRUE)
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
# One color, more curved; hide links with weight below 0.5
p + mira_interlayer(show = TRUE, color = "red", curvature = 0.8, min_weight = 0.5)
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
# Only between some layers (this also shows them)
p + mira_interlayer(pairs = list(c("layer_1", "layer_2")))
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
# Color by a link column, and choose the colors (see ?mira_scales)
p + mira_interlayer(show = TRUE, color_by = "type",
color_values = c(interlayer = "black"))
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
p + mira_interlayer(show = TRUE, color_by = "type", color_scale = "categorical")
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
