
Interactive trajectory confluence (plotly): hover a stream for its trajectory
Source:R/plot_trajectory_confluence_interactive.R
plot_trajectory_confluence_interactive.RdThe plotly twin of plot_trajectory_confluence(). Every trajectory is a filled
stream over the publication year, laid out by the same centered lane packing and
coloured by the same rule (per destination central in the whole-forest / multi
view, per tributary in a single-central view). There is no legend: hovering a
central river shows tr::cNgN (size) (plus its labels_text description),
and hovering a tributary shows trN (n/cohort -> tr::cNgN). With
label_terminal = TRUE the central (or selected) rivers are also named in a
de-overlapped column on the right, joined to their stream by a leader line.
Returns a plotly htmlwidget.
Usage
plot_trajectory_confluence_interactive(
conf,
target = "all",
depth = NULL,
min_n = 5,
min_prop = 0.05,
min_total_size = 0,
min_duration_years = 0,
width_range = c(0, 0.42),
palette = NULL,
labels_text = NULL,
label_terminal = TRUE,
label_size = 12,
smooth = TRUE,
title = NULL
)Arguments
- conf
A
sniff_trajectory_confluence()object.- target
What to draw, as in
plot_trajectory_confluence()minus the focus view:"all"(default) the whole forest,"finals"the central backbones,"intermediary"the tributary streams, a single centraltr::cNgN(its feeders, coloured per tributary), or a vector of trajectory ids (centrals stacked, or intermediates shown as their feeders).- depth, min_n, min_prop, min_total_size, min_duration_years, width_range, smooth
Passed through to the same pruning / geometry helpers as
plot_trajectory_confluence(); see there for details.- palette
Optional named colour vector overriding the default hues (keyed by destination central in the all/multi view, else by tributary
traj_id).- labels_text
Optional
data.framewith columnsidandtextmapping ids to descriptions, appended to the hover (id: description ...). Central rivers are matched by their group id (cNgN), absorbed tributaries by their own trajectory id (trN);NULL(default) uses the bare id.- label_terminal
Name the central (or selected) rivers in a de-overlapped column to the right, each joined to its stream by a leader line (default
TRUE).- label_size
Font size (px) of those right-hand labels (default
12).- title
Plot title;
NULL(default) derives one fromtarget.
Details
Unlike the static function this covers the forest views only ("all",
"finals", "intermediary", one or more centrals, and an intermediate shown as
its upstream feeders); the single-intermediate focus view and the faint
secondary-destination links are not drawn.
Built with plotly, following the same principles as
plot_trajectory_dag_interactive():
The x-axis is the publication year; the y-axis has no intrinsic meaning (it only packs streams to minimise merge crossings).
Each stream is a filled polygon (
fill = "toself", hoverable over its area); a tributary is grey before the first paper it transfers, then in its colour.There is no legend: detail is revealed on hover, and only the terminal (central or selected) rivers carry a printed label.
An intermediate that delivers 0 documents to the final it flows into is always excluded (as in
plot_trajectory_confluence()).
The widget renders in the RStudio Viewer, embeds in Quarto/Shiny, or saves to a
standalone file with htmlwidgets::saveWidget().
See also
plot_trajectory_confluence(), plot_trajectory_dag_interactive(),
sniff_trajectory_confluence()
Other visualization:
plot_groups_influence_matrix(),
plot_groups_influence_network(),
plot_groups_lineage_2d(),
plot_groups_lineage_3d(),
plot_groups_map(),
plot_groups_map_animation(),
plot_groups_map_interactive(),
plot_groups_per_year(),
plot_trajectory_confluence(),
plot_trajectory_confluence_matrix(),
plot_trajectory_dag(),
plot_trajectory_dag_interactive(),
plot_trajectory_dispersion(),
plot_trajectory_dynamics(),
plot_trajectory_dynamics_interactive(),
plot_trajectory_formation(),
plot_trajectory_lines_2d(),
plot_trajectory_lines_3d()
Examples
if (FALSE) { # \dontrun{
flow <- sniff_trajectory_braid(docs_per_group)
conf <- sniff_trajectory_confluence(flow)
plot_trajectory_confluence_interactive(conf, min_n = 20)
# one central's formation, hover the tributaries for their n/cohort
plot_trajectory_confluence_interactive(conf, target = "tr::c1g1")
} # }