Advanced maps

library(bupaverse)

Combining different profiles

The profile used for nodes and edges can be differentiated using the type_nodes and type_edges attributes instead of the type argument. In this way, information about frequencies and performance, or any other value, can be combined in the same graph.

patients %>%
    process_map(type_nodes = frequency("relative_case"),
                type_edges = performance(mean))

Adding secondary information

You can add a second layer of information to both nodes and edges.

patients %>%
    process_map(type = frequency("relative_case"),
                sec = frequency("absolute"))

Both primary and secondary layers can be differentiated between nodes and edges.

patients %>%
    process_map(type_nodes =  frequency("relative_case"),
                type_edges = performance(units = "hours"),
                sec_nodes = frequency("absolute"),
                sec_edges = performance(FUN = max, units = "hours"))

Customizing colors

Both frequency() and performance() have the argument color_scale and color_edges to customize the colors in the process map:

  • color_scale: set the color scale to fill the nodes. Can be any of the scales in RColorBrewer::brewer.pal.info. Defaults to PuBu (frequency) or Reds (performance)
  • color_edges: any single color to apply to the arrows. Can be a named color, hex-code, or a result of rgb. Defaults to dodgerblue4 (frequency) or red4 (performance)

Configuring the colors can be useful to harmonize the process map aesthetics when using differing layers for nodes and edges.

patients %>%
    process_map(type_nodes = frequency("relative_case", color_scale = "PuBu"),
                type_edges = performance(mean, color_edges = "dodgerblue4"))

Customizing the layout

The layout of the process map can be further customized:

  • Instead of a left-right (LR) layout, the rankdir can be set to TB (top-bottom), BT (bottom-top) or RL (right-left).
  • The varying edge width can be disabled.
  • If render is set to FALSE, the function will return an unrendered graph, which can be further modified. See here for more information.

Read more:


Copyright © 2023 bupaR - Hasselt University