render_drake_ggraph {drake}R Documentation

Visualize the workflow with ggplot2/ggraph using drake_graph_info() output. [Stable]

Description

This function requires packages ggplot2 and ggraph. Install them with install.packages(c("ggplot2", "ggraph")).

Usage

render_drake_ggraph(
  graph_info,
  main = graph_info$default_title,
  label_nodes = FALSE,
  transparency = TRUE
)

Arguments

graph_info

List of data frames generated by drake_graph_info(). There should be 3 data frames: nodes, edges, and legend_nodes.

main

Character string, title of the graph.

label_nodes

Logical, whether to label the nodes. If FALSE, the graph will not have any text next to the nodes, which is recommended for large graphs with lots of targets.

transparency

Logical, whether to allow transparency in the rendered graph. Set to FALSE if you get warnings like "semi-transparency is not supported on this device".

Value

A ggplot2 object, which you can modify with more layers, show with plot(), or save as a file with ggsave().

See Also

vis_drake_graph(), sankey_drake_graph(), drake_ggraph()

Examples

## Not run: 
isolate_example("Quarantine side effects.", {
load_mtcars_example() # Get the code with drake_example("mtcars").
if (requireNamespace("ggraph", quietly = TRUE)) {
  # Instead of jumpting right to vis_drake_graph(), get the data frames
  # of nodes, edges, and legend nodes.
  drake_ggraph(my_plan) # Jump straight to the static graph.
  # Get the node and edge info that vis_drake_graph() just plotted:
  graph <- drake_graph_info(my_plan)
  render_drake_ggraph(graph)
}
})

## End(Not run)

[Package drake version 7.13.10 Index]