View source: R/path-trajectory.R
| plot_path_trajectories | R Documentation |
Draws the optimal route family returned by paths() using the
trajectory-tree grammar ported from the transitiontrees package: leaves
stacked in depth-first order, parents centred on their children, and
branches carried by a cosine smoothstep. Nodes follow that package's
horizontal phylogram rather than its capsule style – a count-sized filled
circle with its label set below it. Node size and branch width always show
how many optimal routes use a branch. Every node also prints the value of
the chosen measure beside its vertex name, so nothing is encoded by
colour alone: the default frequency view is free to fill each node with its
vertex's own colour, while the "time" and "predictability" views fill
from a ramp with a colour bar.
Forward paths grow away from the queried source. Backward paths are flipped so the queried target is the root and possible senders branch away from it. A named vertex repeats whenever it is reached under a different temporal history.
plot_path_trajectories(
x,
measure = c("frequency", "time", "predictability"),
orientation = c("horizontal", "vertical"),
min_count = 1L,
base_size = 11,
palette = "okabe"
)
x |
A result from |
measure |
What each node reports, and what fills it. |
orientation |
|
min_count |
Draw only branches used by at least this many optimal
routes. Defaults to |
base_size |
Base text size, as in |
palette |
Palette for the vertex colours of the frequency view, as in
|
A ggplot object. A tree with no branch to draw raises
dynet_empty_result; an x that is neither a paths() nor a
path_trajectories() result, or a base_size that is not one positive
number, raises dynet_bad_input.
path_trajectories() for the tidy tree behind the plot.
dn <- dynet(school_contacts)
routes <- paths(dn, from = "Ana")
plot_path_trajectories(routes)
plot_path_trajectories(routes, measure = "time", orientation = "vertical")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.