Skip to contents

Controls edge rendering. A network is chosen by name — a group (group) or a unit (unit), optionally with compare / also — or given as data with weights (any vector, matrix or data frame, as rENA's ena.plot.network() accepts). Name calls replace the plot's named network; weights calls add a layer, so repeated calls overlay. qe_edges(show = FALSE) clears every network.

Usage

qe_edges(
  p,
  group = NULL,
  unit = NULL,
  weights = NULL,
  compare = NULL,
  also = NULL,
  colors = NULL,
  threshold = NULL,
  name = NULL,
  show = TRUE,
  color_scale = c("model", "plot", "absolute"),
  edge_width = NULL,
  magnify = NULL,
  fixed_size = NULL,
  self_size = NULL
)

Arguments

p

A qe_plot object.

group

Name of the primary group whose mean edge network to draw. Must match a value in the model's group column. Mutually exclusive with unit.

unit

ID of a single unit whose individual edge network to draw (e.g. "FirstGame::steven z"). Mutually exclusive with group. compare and also are not supported when unit is supplied.

weights

Explicit network data: a named numeric vector (names "A & B" or "A.B"; missing edges are 0), an unnamed vector in the model's edge-column order, a matrix / data frame of rows (column means; non-numeric columns are dropped, so set$line.weights[...] works), or a named list of any of those (one layer each). Signed: positive weights use colors[1], negative colors[2]. Drawn on the model's scales — absolute width, and colour from the model-wide range (values beyond it clamp). Mutually exclusive with group / unit.

compare

Name of a second group to subtract (group − compare), or — with weights — explicit data in any weights form, or a group name (weights − that group's mean). Positive differences use the primary colour; negative the secondary. Cannot be combined with unit.

also

Name of a second group to overlay alongside group. Cannot be combined with unit.

colors

c(positive, negative) colours for this network, or one colour (negatives then use its complement, as in rENA). Default: the group's palette colour(s); the first two palette colours for weights.

threshold

c(min, max), or min alone: edges with |weight| < min are not drawn and |weight| > max is capped at max (sign kept) — rENA's threshold semantics.

name

Label for this network layer, reported in edge events and tooltips. Default: the group / unit name, list element names, or "network 1", "network 2", ….

show

Logical. FALSE clears all networks (named and explicit). Default TRUE.

color_scale

How edge weights map to colour, using webENA's ramps (saturation 0.25–1, opacity 0.3–1). "model" (default) rescales from the smallest to the largest non-zero weight anywhere in the model, so separate plots of the same model (one group, another group, a unit, a subtraction) share one colour scale. "plot" rescales within this plot, as webENA does. "absolute" skips the ramps: saturation = opacity = |weight|.

edge_width

Width of an edge of weight 1, as a fraction of the plot width. Width is absolute (raw weight × this), as in webENA, so equal weights draw equally wide in graphs of the same size; each node's diameter is the sum of its edges' widths. NULL uses qeviz's default (0.04).

magnify

Multiply this plot's edge widths and node sizes (colour is unchanged), e.g. to make a faint subtraction readable. Whenever it is set — including 1 — the plot is labelled "(scaled N.Nx)", so exported plots state their scaling (webENA labels its side plots "(scaled 1.0x)" for the same reason). NULL (default) means no magnification and no label.

fixed_size

Logical. TRUE keeps edge widths (lines, directed triangles, self-connection dots, hover targets) at their zoom-1 on-screen width when the plot is zoomed; FALSE lets them grow with the zoom (the default behaviour). Applies to every network of the plot. NULL (default) leaves the current setting unchanged.

self_size

Size of ONA self-connection dots: "node" draws each at half its code node's radius (as webENA does), so the self weight only sets its colour; a positive number is that fraction of the node radius. Applies to every network of the plot. NULL (default) leaves the current setting unchanged (initially: sized by weight, like the edges).

Value

The modified qe_plot object.

Details

Use qe_units() to inspect the unit IDs present in the model.

Examples

if (FALSE) { # \dontrun{
# Two plots on the same scale (the default): SecondGame's lighter, thinner
# lines mean weaker connections, not a different scaling
qe_plot(set) |> qe_edges("FirstGame")
qe_plot(set) |> qe_edges("SecondGame")

# Single group mean network, by name or from data
qe_plot(set) |> qe_edges("FirstGame")
m <- as.matrix(set$line.weights)
fg <- set$meta.data$Condition == "FirstGame"
sg <- set$meta.data$Condition == "SecondGame"
qe_plot(set) |> qe_edges(weights = m[fg, ])

# Subtraction from data, with explicit colours
qe_plot(set) |> qe_edges(weights = m[fg, ], compare = m[sg, ], colors = c("blue", "red"))

# A non-group subset, thresholded
qe_plot(set) |> qe_edges(weights = m[set$points$SVD1 > 0, ], threshold = 0.05,
                         name = "SVD1 > 0")

# Individual unit network
qe_plot(set) |> qe_edges(unit = "FirstGame::steven z")

# Individual unit + show all group means
qe_plot(set) |> qe_group() |> qe_edges(unit = "FirstGame::steven z")

# Subtraction
qe_plot(set) |> qe_edges("FirstGame", compare = "SecondGame")

# Overlay
qe_plot(set) |> qe_edges("FirstGame", also = "SecondGame")

# No edges (means and/or points only)
qe_plot(set) |> qe_group() |> qe_edges(show = FALSE)
} # }