Plot Paths as Sankey Network

plot_path_network(
  paths,
  max_depth = 3,
  nodePadding = 8,
  nodeHeight = 10,
  sinksRight = FALSE,
  remove_common_root = TRUE,
  names_to_colours = name_to_traffic_light,
  height = NULL,
  ...,
  method = 1,
  weight_by = c("n_files", "size", "none")[1],
  sizes = NULL
)

Arguments

paths

character vector of paths

max_depth

maximum depth of paths to be shown

nodePadding

passed to sankeyNetwork, see there. Decrease this value (e.g. `nodePadding = 0`) if there are many nodes to plot and the plot does not look as expected

nodeHeight

height of a node in pixels. Used to calculate the total plot height.

sinksRight

passed to sankeyNetwork, see there

remove_common_root

remove the common root parts? (default: TRUE)

names_to_colours

if not NULL expected to be a function that accepts a vector of (node) names and returns a vector of (colour) names of same length. This function will be called by plot_path_network to determine the colour for each node based on its name. By default, the function name_to_traffic_light is called.

height

plot height in pixels, passed to sankeyNetwork. If NULL, the height is calculated based on nodeHeight, nodePadding and the maximum number of nodes at one folder depth.

...

further arguments passed to sankeyNetwork, such as nodeWidth, nodePadding, fontSize

method

if 1 (default) the function behaves as before, another value activates the new preparation of paths accepting/using an object of class pathlist

weight_by

one of "n_files", "size", "none". Specifies whether to set the link widths according to the total number or total size of files in subsequent folders or by setting all links to the same width.

sizes

file sizes corresponding to the paths

Value

object representing an HTML page

Examples

# Get the paths to all folders on the desktop
paths <- dir(system.file(package = "fakin.path.app"), recursive = TRUE)

# Plot the folder network
plot_path_network(paths)