Styles the links within layers: color by a link column (color_by) or
one constant (color), hide weak links (min_weight), size arrowheads
(arrow_size). Add it to a plot made with mira().
Usage
mira_intralayer(
color_by,
color,
min_weight,
arrow_size,
color_values,
color_scale,
color_palette,
color_reverse,
color_limits
)Arguments
- color_by
Link column to color intralayer links by (a column of
net$extended, e.g."type"; notweight, which sets the links' width).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).- arrow_size
Arrowhead size, between 0 and 3 (1 = MiRA's default). Directed networks only. MiRA has one arrowhead size, so this also sizes the arrowheads of directed interlayer links.
- 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.
See also
mira_interlayer() for the links between layers;
mira_scales for color_values and color_scale.
Other components:
mira_camera(),
mira_filter(),
mira_interlayer(),
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.
# Color by a link column
p + mira_intralayer(color_by = "type")
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
# One color; hide links with weight below 0.05
p + mira_intralayer(color = "grey60", min_weight = 0.05)
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
# Choose the colors (see ?mira_scales)
p + mira_intralayer(color_by = "type", color_values = c(pollination = "#d62728"))
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
p + mira_intralayer(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.
# Arrowheads, on a directed network
mira(net, bipartite = TRUE, setA_type = "bird", directed = TRUE) +
mira_intralayer(arrow_size = 0.5)
#> Not opened: R is not interactive. Print the plot in an R session, or give `browser` to open it from a script.
