Renders the elementwise edge-weight difference x - y as a heterogeneous
transition network. Accepts:
Usage
plot_htna_diff(
x,
y = NULL,
pos_color = "#009900",
neg_color = "#C62828",
group_colors = htna_palette,
...
)Arguments
- x
One of: an htna network, a
net_permutationresult, or anet_permutation_group.- y
htna network (only used when
xis also an htna network).- pos_color
Edge colour for positive differences. Default
"#009900".- neg_color
Edge colour for negative differences. Default
"#C62828".- group_colors
Character vector of colours, one per actor group. Defaults to the built-in htna_palette.
- ...
Forwarded to the underlying splot dispatcher (
cograph::splot()orcograph::splot.net_permutation()).
Details
Two htna networks (
x,y): plotsx - yviacograph::splot()with positive/negative edge coloring.A
net_permutationresult: routes throughcograph::splot.net_permutation()so the significance overlay (significant pos/neg edges, dashed non-significant edges, stars) is drawn upstream.A
net_permutation_group(the result ofpermutation_htna()on anhtna_group): iterates over all pairwise comparisons and plots each, titled with the pair name (nopar(mfrow=...)management - user controls layout).A
bayes_compare_htna()result for two networks, which also inheritsnet_permutation.
In all cases the layout, node colours and donut match plot_htna();
the drawing itself is done by cograph.
Examples
data(human_ai)
# Two networks: early vs late sessions
early <- build_htna(subset(human_ai, phase == "Early"),
actor_type = "actor_type")
#> Metadata aggregated per session: ties resolved by first occurrence in 'session_date' (1 sessions), 'cluster' (18 sessions), 'actor_type' (15 sessions)
late <- build_htna(subset(human_ai, phase == "Late"),
actor_type = "actor_type")
#> Metadata aggregated per session: ties resolved by first occurrence in 'cluster' (24 sessions), 'actor_type' (9 sessions)
plot_htna_diff(early, late)
# Permutation test on a grouped network: one plot per cohort pair
grp <- build_htna(human_ai, actor_type = "actor_type", group = "phase")
#> Metadata aggregated per session: ties resolved by first occurrence in 'cluster' (24 sessions), 'actor_type' (9 sessions)
#> Metadata aggregated per session: ties resolved by first occurrence in 'session_date' (1 sessions), 'cluster' (18 sessions), 'actor_type' (15 sessions)
perm <- permutation_htna(grp, iter = 50, seed = 1)
plot_htna_diff(perm)
plot_htna_diff(perm, show_nonsig = TRUE)
